Browse Source

UpDown controls: added MouseWheelActiveOnFocus property which allows you to decide if the control must have focus in order for the mouse wheel to incement/decrement the value. True by default.

import/raw
brianlagunas_cp 16 years ago
parent
commit
56f8bf9170
  1. 13
      Main/Source/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Core/Primitives/UpDownBase.cs

13
Main/Source/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Core/Primitives/UpDownBase.cs

@ -44,6 +44,17 @@ namespace Microsoft.Windows.Controls.Primitives
#endregion //AllowSpin #endregion //AllowSpin
#region MouseWheelActiveOnFocus
public static readonly DependencyProperty MouseWheelActiveOnFocusProperty = DependencyProperty.Register("MouseWheelActiveOnFocus", typeof(bool), typeof(UpDownBase<T>), new UIPropertyMetadata(true));
public bool MouseWheelActiveOnFocus
{
get { return (bool)GetValue(MouseWheelActiveOnFocusProperty); }
set { SetValue(MouseWheelActiveOnFocusProperty, value); }
}
#endregion //MouseWheelActiveOnFocus
#region ShowButtonSpinner #region ShowButtonSpinner
public static readonly DependencyProperty ShowButtonSpinnerProperty = DependencyProperty.Register("ShowButtonSpinner", typeof(bool), typeof(UpDownBase<T>), new UIPropertyMetadata(true)); public static readonly DependencyProperty ShowButtonSpinnerProperty = DependencyProperty.Register("ShowButtonSpinner", typeof(bool), typeof(UpDownBase<T>), new UIPropertyMetadata(true));
@ -155,7 +166,7 @@ namespace Microsoft.Windows.Controls.Primitives
{ {
base.OnMouseWheel(e); base.OnMouseWheel(e);
if (!e.Handled && AllowSpin && TextBox.IsFocused) if (!e.Handled && AllowSpin && ((TextBox.IsFocused && MouseWheelActiveOnFocus) || !MouseWheelActiveOnFocus))
{ {
if (e.Delta < 0) if (e.Delta < 0)
{ {

Loading…
Cancel
Save