Given that you have a control that fires a command:
Is there a way to prevent the command from being fired
Wrap the code in a try-catch-finally or try-finally block. The finally statement will always be called regardless of any error occurring in the try.
Example
private Cursor _CursorType;
// Property to set and get the cursor type
public Cursor CursorType
{
get {return _CursorType; }
set
{
_CursorType = value;
OnPropertyChanged("CursorType");
}
}
private void ExecutedMethodOnButtonPress()
{
try
{
CursorType = Cursors.Wait;
// Run all other code here
}
finally
{
CursorType = Cursors.Arrow;
}
}
NOTE: the CursorType is a property that the UserControl or Window is bound to