0
這是一個例子Combobox,其中一切正常,選定的值根據CurrentPlanSet的變化而變化。如何在devexpress組合框BarItem中設置SelectedItem屬性的值?
<dxe:ComboBoxEdit ItemsSource="{Binding PlanSets, Mode=TwoWay}"
DisplayMember="Name"
ValueMember="Name"
SelectedItem="{Binding CurrentPlanSet, Mode=TwoWay}"
/>
在此示例中,所選值不會根據CurrentPlanSet更改而更改。
<dxb:BarEditItem Content="Plan Sets" EditWidth="350">
<dxb:BarEditItem.EditStyle>
<Style TargetType="{x:Type dxe:ComboBoxEdit}">
<Setter Property="SelectedIndex" Value="{Binding CurrentPlanSet, Mode=TwoWay}"/>
</Style>
</dxb:BarEditItem.EditStyle>
<dxb:BarEditItem.EditSettings >
<dxe:ComboBoxEditSettings ItemsSource="{Binding PlanSets, Mode=TwoWay}" ValueMember="Id" DisplayMember="Name" />
</dxb:BarEditItem.EditSettings>
</dxb:BarEditItem>
如何在第二個代碼示例中正確設置SelectedItem屬性的值?