【发布时间】:2021-12-26 01:06:43
【问题描述】:
今天我已将所有交互触发器从 http://schemas.microsoft.com/expression/2010/interactivity 更改为 http://schemas.microsoft.com/xaml/behaviors。现在我的问题是,视图模型中没有触发 selectionChanged 事件。我的数据源是视图模型。
我的代码:
<ComboBox Name="CBGL" ItemsSource="{Binding Path=Troughs}"
DisplayMemberPath="TroughNumber" SelectedValuePath="Id"
SelectedValue="{Binding Model.Trough}" Width="173">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding CBGLRegionChangedCmd}" />
</i:EventTrigger>
</i:Interaction.Triggers>
如果有人更改了选择,CBGLRegionChangedCmd 不会触发。
来自视图模型的代码:
CBGLRegionChangedCmd = new MyICommand(InvokeCommandAction_Changed);
如果我撤消更新一切正常...
【问题讨论】:
-
这些答案有帮助吗? stackoverflow.com/questions/20743961/…
标签: wpf prism .net-core-3.1 interaction