Why does this binding doesn't work through XAML but does by code ?
        Posted  
        
            by user361899
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user361899
        
        
        
        Published on 2010-06-08T23:37:03Z
        Indexed on 
            2010/06/08
            23:42 UTC
        
        
        Read the original article
        Hit count: 285
        
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 :-)
© Stack Overflow or respective owner