Browse Source

Spinner: fixed bug when exception occurred when the spinner button was clicked after typing a number above the maximum allowed.

pull/1645/head
brianlagunas_cp 16 years ago
parent
commit
3b0508eb3a
  1. 8
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ButtonSpinner/Spinner.cs

8
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ButtonSpinner/Spinner.cs

@ -54,18 +54,16 @@ namespace Microsoft.Windows.Controls
{ {
ValidSpinDirections valid = e.Direction == SpinDirection.Increase ? ValidSpinDirections.Increase : ValidSpinDirections.Decrease; ValidSpinDirections valid = e.Direction == SpinDirection.Increase ? ValidSpinDirections.Increase : ValidSpinDirections.Decrease;
if ((ValidSpinDirection & valid) != valid) //Only raise the event if spin is allowed.
if ((ValidSpinDirection & valid) == valid)
{ {
// spin is not allowed.
throw new InvalidOperationException("Spin action is not valid at this moment.");
}
EventHandler<SpinEventArgs> handler = Spin; EventHandler<SpinEventArgs> handler = Spin;
if (handler != null) if (handler != null)
{ {
handler(this, e); handler(this, e);
} }
} }
}
/// <summary> /// <summary>
/// Called when valid spin direction changed. /// Called when valid spin direction changed.

Loading…
Cancel
Save