我想绑定到静态类的静态属性, 此属性包含从文件反序列化的设置。为什么此绑定不能通过XAML工作,而是通过代码实现?
它从来没有与下面的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}" />
它确实由然而代码工作:
comboboxThemes.ItemsSource = Settings.Themes;
任何想法?
谢谢:-)
另外,我现在也有设计时预览! – Aybe 2010-06-10 10:55:59