Prevent double-click from double firing a command

前端 未结 14 1798
情书的邮戳
情书的邮戳 2020-12-15 08:34

Given that you have a control that fires a command:

Is there a way to prevent the command from being fired

14条回答
  •  借酒劲吻你
    2020-12-15 09:26

    A simple and elegant solution is to create a Behavior disabling reaction on second click in double-click scenario. That's pretty easy to use:

      
    

    Behavior (more about behaviors - https://www.jayway.com/2013/03/20/behaviors-in-wpf-introduction/)

    using System.Windows.Controls;
    using System.Windows.Input;
    using System.Windows.Interactivity;
    
    public class DisableDoubleClickBehavior : Behavior

提交回复
热议问题