If you are following mvvm design pattern there are such steps:
1. In your userControl model create a property and call it ControlId.
2. Add userControls to some variable: for example List or ConcurrentBag or whatever.
3. Bind this to your view(MainWIndow).
4. Implement Event on your MainWIndowViewModel to check for userControls.
Example:
YourUserControlModel.cs :
public int ControlId{get;set;}
Set somewhere this property.
Load your usercontrols in constructor like this:
public MainWindowViewModel()
{
Controls.Add(new YourUserControl());
}
private readonly DeferrableObservableCollection<YourUserControl> Controls = new DeferrableObservableCollection<YourUserControl>();
Event to look for userControls:
void SomeName(object Sender, EventArgs e)
{
foreach(var control in Controls)
{
if(control.ViewModel.Model.ControlId == 1)
}
}
Hope this helped you.
If you have questions feel free to ask.