目前我使用以下代码处理网格上的双击事件。现在,需求已更改,因此只需单击一次即可选择项目,而不是双击。检测单击的事件是什么?
<EventSetter Event="MouseDoubleClick" Handler="row_MouseDoubleClick"/>
我试图点击单击而没有成功。
<EventSetter Event="MouseLeftButtonDown" Handler="row_MouseDoubleClick"/>
时,我看不到程序在断点处断开
的MouseLeftButtonDown
已实施
请建议,
此致
乔。
答案 0 :(得分:1)
立即购买ListView,免费获取选择!
<ListView>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<Grid IsItemsHost="True">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Grid.Column" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content.(Grid.Column)}"/>
<Setter Property="Grid.Row" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content.(Grid.Row)}"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemsSource>
<x:Array Type="{x:Type sys:Object}">
<TextBlock Grid.Column="0" Grid.Row="0" Text="Lorem"/>
<TextBlock Grid.Column="1" Grid.Row="0" Text="Ipsum"/>
<TextBlock Grid.Column="0" Grid.Row="1" Text="Dolor"/>
<TextBlock Grid.Column="1" Grid.Row="1" Text="Sit"/>
</x:Array>
</ListView.ItemsSource>
</ListView>
答案 1 :(得分:0)
怎么样,
<EventSetter Event="MouseUp" Handler="row_MouseClick"/>