I have a ComboBox defined in a Styles.xaml file. The ViewModel object is defined as a resource in the MainPage.xaml file. The ItemSource of the ComboBox is a List in the ViewModel. Hence, I need the binding for the ItemSource to look for the list at runtime and not in the Style file. What can I do for this?
<ComboBox Grid.Column="1"
HorizontalAlignment="{TemplateBinding HorizontalContentA开发者_如何学编程lignment}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
ItemsSource="{Binding Source={StaticResource vm}, Path=WtItemSource}"
Style="{StaticResource HorizontalComboBox}"
Width="70"
d:LayoutOverrides="Width" />
Here, vm is the viewmodel object, but is defined in MainPage.xaml as,
<local:Util x:Key="vm"/>
加载中,请稍侯......
精彩评论