Why does this binding doesn't work through XAML but does by code ?
- by user361899
I am trying to bind to a static property on a static class,
this property contains settings that are deserialized from a file.
It never works with the following XAML :
<Window.Resources>
<ObjectDataProvider x:Key="wrapper" ObjectType="{x:Type Application:Wrapper}"/>
</Window.Resources>
<ScrollViewer x:Name="scrollViewer" ScrollViewer.VerticalScrollBarVisibility="Auto"DataContext="{Binding Source={StaticResource wrapper}, UpdateSourceTrigger=PropertyChanged}">
<ComboBox x:Name="comboboxThemes"
SelectedIndex="0"
SelectionChanged="ComboBoxThemesSelectionChanged"
Grid.Column="1"
Grid.Row="8"
Margin="4,3" ItemsSource="{Binding Settings.Themes, Mode=OneWay}" SelectedValue="{Binding Settings.LastTheme, Mode=TwoWay}" />
It does work by code however :
comboboxThemes.ItemsSource = Settings.Themes;
Any idea ?
Thank you :-)