/// <summary> /// Creates the spin control. /// </summary> /// <param name="property"> /// The property. /// </param> /// <returns> /// The control. /// </returns> protected FrameworkElement CreateSpinControl(PropertyItem property) { var tb = new TextBox { BorderThickness = new Thickness(0), HorizontalContentAlignment = HorizontalAlignment.Right }; tb.SetBinding(TextBox.TextProperty, property.CreateBinding()); var c = new SpinControl { Maximum = property.SpinMaximum, Minimum = property.SpinMinimum, SmallChange = property.SpinSmallChange, LargeChange = property.SpinLargeChange, Content = tb }; c.SetBinding(SpinControl.ValueProperty, property.CreateBinding()); return(c); }
/// <summary> /// Creates the spin control. /// </summary> /// <param name="property">The property.</param> /// <returns> /// The control. /// </returns> protected virtual FrameworkElement CreateSpinControl(PropertyItem property) { var tb = new TextBoxEx { IsReadOnly = property.IsReadOnly, BorderThickness = new Thickness(0), HorizontalContentAlignment = ConvertHorizontalAlignment(property.HorizontalAlignment), VerticalContentAlignment = VerticalAlignment.Center }; tb.SetBinding(TextBox.TextProperty, property.CreateBinding()); var c = new SpinControl { Maximum = property.SpinMaximum, Minimum = property.SpinMinimum, SmallChange = property.SpinSmallChange, LargeChange = property.SpinLargeChange, Content = tb }; // Note: Do not apply the converter to the SpinControl c.SetBinding(SpinControl.ValueProperty, property.CreateBinding(UpdateSourceTrigger.Default, false)); return(c); }
/// <summary> /// Creates the spin control. /// </summary> /// <param name="property">The property.</param> /// <returns> /// The control. /// </returns> protected virtual FrameworkElement CreateSpinControl(PropertyItem property) { var tb = new TextBoxEx { IsReadOnly = property.IsReadOnly, BorderThickness = new Thickness(0), HorizontalContentAlignment = ConvertHorizontalAlignment(property.HorizontalAlignment), VerticalContentAlignment = VerticalAlignment.Center }; tb.SetBinding(TextBox.TextProperty, property.CreateBinding()); var c = new SpinControl { Maximum = property.SpinMaximum, Minimum = property.SpinMinimum, SmallChange = property.SpinSmallChange, LargeChange = property.SpinLargeChange, Content = tb }; // Note: Do not apply the converter to the SpinControl c.SetBinding(SpinControl.ValueProperty, property.CreateBinding(UpdateSourceTrigger.Default, false)); return c; }
/// <summary> /// Creates the spin control. /// </summary> /// <param name="property"> /// The property. /// </param> /// <returns> /// The control. /// </returns> protected FrameworkElement CreateSpinControl(PropertyItem property) { var tb = new TextBox { BorderThickness = new Thickness(0), HorizontalContentAlignment = HorizontalAlignment.Right }; tb.SetBinding(TextBox.TextProperty, property.CreateBinding()); var c = new SpinControl { Maximum = property.SpinMaximum, Minimum = property.SpinMinimum, SmallChange = property.SpinSmallChange, LargeChange = property.SpinLargeChange, Content = tb }; c.SetBinding(SpinControl.ValueProperty, property.CreateBinding()); return c; }