Josh G Josh G - 5 months ago 48
C# Question

Prevent double-click from double firing a command

Given that you have a control that fires a command:

<Button Command="New"/>


Is there a way to prevent the command from being fired twice if the user double clicks on the command?

EDIT: What is significant in this case is that I am using the Commanding model in WPF.

It appears that whenever the button is pressed, the command is executed. I do not see any way of preventing this besides disabling or hiding the button.

Answer

Perhaps the button should disabled after the first click and until the processing has been completed?