I want to populate data on user control Combobox and others only when the user control is loaded.
The problem with this is that I do not know how to initiate an OnLoaded event for a user control.
I wanted to extract data from the object to be assigned each time the user control is selected, as this data will change.
This is not the exact code, but just quick summary of what I want to do. PS. There is a Load Event handler that works on XAML.
EDIT: I had wanted to add that Test1 control is previously initialized. I had created workaround for this issue but it's not the answer to this question :(.
public partial class Test1 : UserControl
{
public Test1()
{
InitializeComponent();
}
public void Test1_Loaded(Object sender, EventArgs e)
{
foreach(var element in somedict.keys)
{
combobox1.Items.Add(element);
}
}
}