我使用一个附加行为,使得双击事件可以与视图模型中的命令绑定,如下所示:
<ListBox Style="{StaticResource MasterListBoxStyle}"
b:SelectionBehavior.DoubleClickCommand="{Binding EditCommand}"
>
我需要一个演示中的多个列表框,所有这些列表框都需要一个双击事件与一个编辑命令相关联。
我能把这个行为放到我的MasterListBoxStyle中吗?如何操作?
谢谢,
Berryl
<Style x:Key="MasterListBoxStyle" TargetType="ListBox">
<Setter Property="ItemsSource" Value="{Binding MasterVm.AllDetailVms}" />
<Setter Property="ItemContainerStyle" Value="{StaticResource MasterListingRowStyle}" />
<Setter Property="IsSynchronizedWithCurrentItem" Value="True" />
<Setter Property="AlternationCount" Value="2" />
</Style>