C# Class DynamicVizSegmenter.CustomControls.NumericUpDownTextBox

Interaction logic for NumericUpDownTextBox.xaml
Inheritance: System.Windows.Controls.TextBox
Mostra file Open project: nickun/OCRonet Class Usage Examples

Public Properties

Property Type Description
ButtonBackgroundProperty System.Windows.DependencyProperty
ButtonBorderBrushProperty System.Windows.DependencyProperty
ButtonBorderThicknessProperty System.Windows.DependencyProperty
ButtonCornerRadiusProperty System.Windows.DependencyProperty
ButtonForegroundProperty System.Windows.DependencyProperty
ButtonMouseOverBackgroundProperty System.Windows.DependencyProperty
ButtonPressedBackgroundProperty System.Windows.DependencyProperty
DelayProperty System.Windows.DependencyProperty
IntervalProperty System.Windows.DependencyProperty
MaxValueProperty System.Windows.DependencyProperty
MinValueProperty System.Windows.DependencyProperty
ValueProperty System.Windows.DependencyProperty

Public Methods

Method Description
NumericUpDownTextBox ( ) : System

Constructor: initializes the TextBox, creates the buttons, and attaches event handlers for the buttons and TextBox

Protected Methods

Method Description
ArrangeOverride ( Size arrangeSize ) : Size

Called to arrange and size the content of a System.Windows.Controls.Control object.

GetVisualChild ( int index ) : Visual

Overrides System.Windows.Media.Visual.GetVisualChild(System.Int32), and returns a child at the specified index from a collection of child elements.

Private Methods

Method Description
Add ( int value ) : void

Works directly with the Value property to increment or decrement the integer value in the textbox

ButtonPropertyChangedCallback ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
ButtonTimerCallback ( Object sender ) : void
Button_Click ( object sender, RoutedEventArgs e ) : void

Handles up button click (ie increment TextBox value)

Button_PreviewMouseDown ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void

When mouse button is depressed over the up or down button, initiates the RepeatButton behaviour by setting up a timer

Button_PreviewMouseUp ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void

Resets the repeat button so no longer active when Mouse button released Does not matter if mouse is on button or not

FixValue ( ) : int

Only does something if the Textbox contains an out of range number

FixValueKeyPress ( int value ) : bool

Will fix value only if the value is beyond what could be a valid entry given more characters could be added to TextBox

HandleModifiers ( int value ) : void

Checks if any of the Keyboard modifier keys are pressed that might affect the change in the value of the TextBox. In this case only the shift key affects the value

MinMaxValueChangedCallback ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnValueChanged ( ) : void
RepeatButtonCallback ( object o ) : void

Observes the button timer event for the repeat button functionality, and then starts the 'Value' dependency property change process Note: Cannot interact directly with UI from this event

RepeatButtonDispatched ( int value ) : void

Checks that mouse cursor is in the button, and if so updates the 'Value' dependency property

UpdateText ( int value ) : void
ValueChangedCallback ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
control_LostFocus ( object sender, RoutedEventArgs e ) : void
control_PreviewKeyDown ( object sender, System.Windows.Input.KeyEventArgs e ) : void

Checks if the keypress is the up or down key, and then handles keyboard input

control_PreviewTextInput ( object sender, System.Windows.Input.TextCompositionEventArgs e ) : void

Ensures that keypress is a valid character (numeric or negative sign) - negative sign ('-') only allowed if Minimum value less than 0, the entry is at the beginning of the text and there is not already a negative sign - number only allowed if not beginning of text and there is a negative sign

Method Details

ArrangeOverride() protected method

Called to arrange and size the content of a System.Windows.Controls.Control object.
protected ArrangeOverride ( Size arrangeSize ) : Size
arrangeSize System.Windows.Size The computed size that is used to /// arrange the content
return System.Windows.Size

GetVisualChild() protected method

Overrides System.Windows.Media.Visual.GetVisualChild(System.Int32), and returns a child at the specified index from a collection of child elements.
protected GetVisualChild ( int index ) : Visual
index int The zero-based index of the requested child element in the collection.
return Visual

NumericUpDownTextBox() public method

Constructor: initializes the TextBox, creates the buttons, and attaches event handlers for the buttons and TextBox
public NumericUpDownTextBox ( ) : System
return System

Property Details

ButtonBackgroundProperty public_oe static_oe property

public static DependencyProperty,System.Windows ButtonBackgroundProperty
return System.Windows.DependencyProperty

ButtonBorderBrushProperty public_oe static_oe property

public static DependencyProperty,System.Windows ButtonBorderBrushProperty
return System.Windows.DependencyProperty

ButtonBorderThicknessProperty public_oe static_oe property

public static DependencyProperty,System.Windows ButtonBorderThicknessProperty
return System.Windows.DependencyProperty

ButtonCornerRadiusProperty public_oe static_oe property

public static DependencyProperty,System.Windows ButtonCornerRadiusProperty
return System.Windows.DependencyProperty

ButtonForegroundProperty public_oe static_oe property

public static DependencyProperty,System.Windows ButtonForegroundProperty
return System.Windows.DependencyProperty

ButtonMouseOverBackgroundProperty public_oe static_oe property

public static DependencyProperty,System.Windows ButtonMouseOverBackgroundProperty
return System.Windows.DependencyProperty

ButtonPressedBackgroundProperty public_oe static_oe property

public static DependencyProperty,System.Windows ButtonPressedBackgroundProperty
return System.Windows.DependencyProperty

DelayProperty public_oe static_oe property

public static DependencyProperty,System.Windows DelayProperty
return System.Windows.DependencyProperty

IntervalProperty public_oe static_oe property

public static DependencyProperty,System.Windows IntervalProperty
return System.Windows.DependencyProperty

MaxValueProperty public_oe static_oe property

public static DependencyProperty,System.Windows MaxValueProperty
return System.Windows.DependencyProperty

MinValueProperty public_oe static_oe property

public static DependencyProperty,System.Windows MinValueProperty
return System.Windows.DependencyProperty

ValueProperty public_oe static_oe property

public static DependencyProperty,System.Windows ValueProperty
return System.Windows.DependencyProperty