Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
370
Catch MouseDoubleClick in XamTreeGrid TemplateField
posted

I have XamTreeGrid with several template fields. I need to bind LeftDoubleClick to several of them with unique commands bound to each. So I have one general data template for the display of my values and then specific data template to handle each of the LeftDoubleClicks like this:

<DataTemplate x:Key="SpecificValueTemplate" DataType="local:MyDataItem">
<ContentControl ContentTemplate="{StaticResource GeneralValueTemplate}" Content="{Binding SpecificValue}">
<ContentControl.InputBindings>
<MouseBinding Gesture="LeftDoubleClick"
Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wpf:View}, Path=DataContext.SpecificValueLeftDoubleClickCommand}"
CommandParameter="{Binding}" />
</ContentControl.InputBindings>
</ContentControl>
</DataTemplate>

My problem is that I have to double click my value twice before the command is executed. Am I missing something? My CellClickAction is set to "SelectRecord" and the first double click is selecting and de-selecting the row. The second double click is doing the same + executing the command. I want the command to be executed on the first double click.

Parents
No Data
Reply
  • 34690
    Verified Answer
    Offline posted

    Hello Hilma,

    I have been investigating into the behavior you are seeing where the first left button double-click is not being picked up by your DataTemplate. If I had to guess at the reason that this behavior is not working on your end, it would be that the XamTreeGrid is “eating” the first click by handling it, but I have not been able to reproduce this behavior as of yet, and so perhaps something is being set in your application that is not being set in my test project.

    I have attached the sample project I used to test this.  Please test this project on your PC as whether or not it works correctly may help indicate the nature of this problem.

    If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using.  My test was performed using version 20.2.20202.38 of Infragistics for WPF 2020 Volume 2.

    If the project does show the product feature working correctly, this indicates a possible problem in the code of your application.  It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.

    Please let me know if you have any other questions or concerns on this matter.

    XamTreeGridDoubleClickTest.zip

Children