【发布时间】:2014-05-24 16:20:50
【问题描述】:
相关: "Cleanest single click + double click handling in Silverlight?"
在 XAML 中让双击触发某些操作的最简单方法是什么?
我正在尝试做这样的事情,当用户双击 ListBox 项目时关闭一个弹出窗口:
<Popup x:Name="popup">
<ListBox ItemsSource="{Binding Colors}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Rectangle Color="{Binding Color}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="DoubleClick">
<ei:ChangePropertyAction TargetObject="{Binding ElementName=popup}"
PropertyName="IsOpen" Value="False" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Rectangle>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>
</Popup>
上面的问题当然是没有“DoubleClick”事件。所以我需要用双击触发器替换EventTrigger。
【问题讨论】:
标签: c# silverlight xaml blend-sdk