Ric*_*der 4 silverlight combobox
我为组合框创建了一个datatemplate,如下所示:
<DataTemplate x:Key="AircraftTypeTemplate">
<StackPanel Orientation="Horizontal" Width="340">
<ComboBox>
<ComboBoxItem>CJ1</ComboBoxItem>
<ComboBoxItem>CJ3</ComboBoxItem>
<ComboBoxItem>Bravo</ComboBoxItem>
<ComboBoxItem>Excel</ComboBoxItem>
<ComboBoxItem>Sovereign</ComboBoxItem>
</ComboBox>
</StackPanel>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)
它渲染得很好,但我希望能够将值与每个项关联,而不必将其绑定到某些数据上下文.例如,我希望CJ1组合框的值为5.我如何在XAML中设置它们?
喜欢:
<ComboBoxItem Value="5">CJ1</ComboBoxItem>
Run Code Online (Sandbox Code Playgroud)
谢谢!