2

I have a small problem with the field chooser from xam data grid. What i need to do is to change the check / uncheck behavior from double click to one click, which is done here:

<igWPF:LabelPresenter.InputBindings>
          <MouseBinding Command="{x:Static igWPF:FieldChooserCommands.ToggleVisibility}" MouseAction="LeftDoubleClick" />
        </igWPF:LabelPresenter.InputBindings>

If I change the mouse action from left double click to left click, instead of requiring one less click, it needs one more: Two to select the field, and one to check / uncheck.

Is there anything to do about this, am I doing something wrong?

Akos
  • 210
  • 4
  • 14

1 Answers1

1

Found a way around this, the problem is that the mouse left click action is already being used by something else.

To work around this, we need to remove or comment the section of the style i posted above, and create a behavior for the Label Presenter.

 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;
     }
 }
Akos
  • 210
  • 4
  • 14