コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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;
        }
コード例 #4
0
 /// <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;
 }