Combobox MVVM绑定并设置选中

  MVVM绑定Combobox,代码如下

<ComboBox ItemsSource="{Binding TaskType,Mode=TwoWay}"
DisplayMemberPath="DisPlayName"
SelectedItem="{Binding Path=DataSource.SelectedTaskType,Mode=TwoWay}"
Width="80" x:Name="cb_tasktype" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<TriggerActions:MapEventToCommand Command="{Binding SelectTaskTypeChangedCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>

posted on 2013-08-02 15:15  而立未立  阅读(961)  评论(0编辑  收藏  举报