When you set the DataContext, the first time the items are loaded the
control will select the first item in the list. You can subscribe to the
SelectedItemChanged event, then in the same method unsubscribe and set the
default.
public void SetDefaultValue(object o, EventArgs e)
{
((ComboBox)o).SelectedItemChanged-= SetDefaultValue;
((ComboBox)o).SelectedItem = "SomethingElse"
}
You can also consider using MVVM and bind the SelectedItem Property of the
ComboBox to a property of your ViewModel
--------------------------------------------------------------------------------
Support procedure: https://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozsilverlight
Other lists you might want to join: http://www.codify.com/lists