I have a combobox that is bound to an enum using the following code:
cmb.ItemsSource = Enum.GetValues(typeof(DATABASE_TYPES)).Cast<DATABASE_TYPES>();
where DATABASE_TYPES is:
public enum DATABASE_TYPES
{
JDataStore, Access, SQLServer, H2, PostGresSQL, MySQL
};
I have some xml that matches one of the enum values:
<property name="Database.Main.Type"
type="databaseType"
default="JDataStore"
permissions="superuser">
</property>
I am trying to programmatically set the selected item of the combobox to the default value from the xml.
I have tried:
cmb.SelectedItem = propertyNode.Attributes["default"].Value;
but this doesn't work.
Could someone please advise?