Wpf Infragistics xam数据网格字段选择器选择
我对xam数据网格中的字段选择器有一个小问题。 我需要做的是将选中/取消选中行为从双击更改为单击一次,如下所示:Wpf Infragistics xam数据网格字段选择器选择,wpf,infragistics,xamdatagrid,Wpf,Infragistics,Xamdatagrid,我对xam数据网格中的字段选择器有一个小问题。 我需要做的是将选中/取消选中行为从双击更改为单击一次,如下所示: <igWPF:LabelPresenter.InputBindings> <MouseBinding Command="{x:Static igWPF:FieldChooserCommands.ToggleVisibility}" MouseAction="LeftDoubleClick" /> </igWPF:Lab
<igWPF:LabelPresenter.InputBindings>
<MouseBinding Command="{x:Static igWPF:FieldChooserCommands.ToggleVisibility}" MouseAction="LeftDoubleClick" />
</igWPF:LabelPresenter.InputBindings>
如果我将鼠标操作从左双击更改为左单击,而不需要少单击一次,则需要多单击一次:两次选择字段,一次选中/取消选中
有什么办法吗?我做错什么了吗?找到了一种解决方法,问题是鼠标左键单击操作已经被其他东西使用了 为了解决这个问题,我们需要删除或注释我在上面发布的样式部分,并为标签演示者创建一个行为
public class OneClickFieldVisibility : Behavior<LabelPresenter>
{
private LabelPresenter Presenter { get { return this.AssociatedObject; } }
protected override void OnAttached()
{
Presenter.PreviewMouseLeftButtonDown -= Presenter_PreviewMouseLeftButtonDown;
Presenter.PreviewMouseLeftButtonDown += Presenter_PreviewMouseLeftButtonDown;
}
void Presenter_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var fieldChooser = (FieldChooser)Infragistics.Windows.Utilities.GetAncestorFromType(Presenter, typeof(FieldChooser), false);
fieldChooser.ExecuteCommand(FieldChooserCommands.ToggleVisibility, Presenter.Field);
e.Handled = true;
}
}
public class one单击字段可见性:行为
{
私有LabelPresenter Presenter{get{返回this.AssociatedObject;}}
受保护的覆盖无效附加()
{
Presenter.PreviewMouseLeftButtonDown-=Presenter\u PreviewMouseLeftButtonDown;
Presenter.PreviewMouseLeftButtonDown+=Presenter\u PreviewMouseLeftButtonDown;
}
void Presenter\u PreviewMouseLeftButtonDown(对象发送器,鼠标按钮ventargs e)
{
var fieldChooser=(fieldChooser)Infragistics.Windows.Utilities.GetAncestorFromType(Presenter,typeof(fieldChooser),false);
fieldChooser.ExecuteCommand(FieldChooserCommands.ToggleVisibility,Presenter.Field);
e、 已处理=正确;
}
}