I have the following ComboBox:
<ComboBox SelectedItem="{Binding SelectedTheme, Mode=TwoWay}"
ItemsSource="{Binding Themes, Mode=OneTime}" />
It is bound to the following values in my VM:
private Theme _selectedTheme;
public Theme SelectedTheme
{
get { return _selectedTheme; }
set
{
if (_selectedTheme != value)
{
_selectedTheme = value;
OnPropertyChanged();
}
}
}
public List<Theme> Themes =>
Enum.GetValues(typeof(Theme)).Cast<Theme>().ToList();
I set SelectedThemes value in the VM's ctor, and the get member is being hit after I assign the VM instance to my Page's DataContext. My trouble is the UI does not reflect the binding value the first time I load the page; it updates works correctly all other times, but the combobox does not show any selection after the page is initially loaded.