我在我的 WPF 应用程序中使用 Telerik radgridview
<telerik:RadTreeListView Grid.Row="1" Grid.ColumnSpan="2"
Name="WorkPreferenceTreeView"
AutoGenerateColumns="false"
IsReadOnly="True"
ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Views:WorkPreferenceSelectorView}}}"
RowIndicatorVisibility="Collapsed"
SelectedItem="{Binding SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Views:WorkPreferenceSelectorView}}}"
ScrollViewer.HorizontalScrollBarVisibility="Hidden">
<TelerikNavigation:RadContextMenu.ContextMenu>
<TelerikNavigation:RadContextMenu x:Name="RadContextMenu" />
</TelerikNavigation:RadContextMenu.ContextMenu>
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding ItemPreferences}" />
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewDataColumn MinWidth="200" Width="*" CellTemplate="
{StaticResource ItemPreferenceskPreferenceCellTemplate}" Header="Preference" IsFilterable="false"
ShowFieldFilters="false" Name="A" />
我在控件上附加了一个事件
private void InitializeControl()
{
WorkPreferenceTreeView.MouseDoubleClick += (WorkPreferenceTreeView_MouseDoubleClick);
}
现在我的问题是当我双击 radtreelistview 中的 ANYWHERE(甚至在滚动条中)时,MouseDoubleClick 事件就会触发,我只想在双击选定的项目或行时触发它。我想知道我是否可以在所选项目或每一行中附加 MouseDoubleClick,但我没有找到方法来做到这一点。有什么建议吗?