Browse Source

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

import/raw
brianlagunas_cp 16 years ago
parent
commit
0dddb5db96
  1. 16
      Main/Source/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ButtonSpinner/Spinner.cs

16
Main/Source/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ButtonSpinner/Spinner.cs

@ -54,16 +54,14 @@ 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. EventHandler<SpinEventArgs> handler = Spin;
throw new InvalidOperationException("Spin action is not valid at this moment."); if (handler != null)
} {
handler(this, e);
EventHandler<SpinEventArgs> handler = Spin; }
if (handler != null)
{
handler(this, e);
} }
} }

Loading…
Cancel
Save