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 15 years ago
parent
commit
3b0508eb3a
  1. 16
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ButtonSpinner/Spinner.cs

16
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;
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;
if (handler != null)
{
handler(this, e);
EventHandler<SpinEventArgs> handler = Spin;
if (handler != null)
{
handler(this, e);
}
}
}

Loading…
Cancel
Save