【发布时间】:2015-11-20 06:43:17
【问题描述】:
我在 Silverlight 应用程序中有一个 Datagrid。用户可以使用 Tab 键将焦点放在 Datagrid 上,并使用向上和向下箭头键在各行之间移动。
请告知,当用户按下空格键选择行时如何触发行选择事件。
下面是sn-p的代码:
<Custom:ClientControl
x:Class="TestNamespace.Modules.Views.SampleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">
<sdk:DataGrid x:Name="dg" ...>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding DoSomething}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<sdk:DataGrid.Columns>
...
【问题讨论】:
标签: c# xaml silverlight datagrid