ComboBox
原创2023年11月22日小于 1 分钟
ComboxBox如何在VM中触发事件。
引入Microsoft.Xaml.Behaviors.Wpf
在当前根节点下添加如下声明xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
<ComboBox x:Name="ComBo"
DisplayMemberPath="Text"
ItemsSource="{Binding Items}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding TextChanged}" CommandParameter="{Binding ElementName=ComBo, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>