C# Class Hourglass.Windows.Watermark

Provides a DependencyProperty that allows a watermark to be applied to TextBox and ComboBox controls when the control has no actual value.
Show file Open project: Dziemborowicz/Hourglass

Public Properties

Property Type Description
HintBrushProperty System.Windows.DependencyProperty
HintProperty System.Windows.DependencyProperty

Public Methods

Method Description
GetHint ( Control control ) : object

Returns the value of the HintProperty.

GetHintBrush ( Control control ) : System.Windows.Media.Brush

Returns the value of the HintBrushProperty.

SetHint ( Control control, object value ) : void

Sets the value of the HintProperty.

SetHintBrush ( Control control, System.Windows.Media.Brush value ) : void

Sets the value of the HintBrushProperty.

Private Methods

Method Description
AddWatermarkAdorner ( Control control, object hint, System.Windows.Media.Brush brush ) : void

Adds a WatermarkAdorner to a Control.

BindControl ( Control control ) : void

Binds the event handlers for to a Control.

ComboBoxSelectionChanged ( object sender, System.Windows.Controls.SelectionChangedEventArgs e ) : void

Invoked when the selection of a combo box control changes.

ComboBoxTextChanged ( object sender, RoutedEventArgs e ) : void

Invoked when content changes in a combo box control changes.

ControlGotKeyboardFocus ( object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e ) : void

Invoked when the keyboard is focused on a control.

ControlLoaded ( object sender, RoutedEventArgs e ) : void

Invoked when the control is laid out, rendered, and ready for interaction.

ControlLostKeyboardFocus ( object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e ) : void

Invoked when the keyboard is no longer focused on a control.

DependencyPropertyChanged ( DependencyObject sender, System.Windows.DependencyPropertyChangedEventArgs e ) : void

Invoked when the effective value of a DependencyProperty changes.

GetWatermarkAdorner ( Control control ) : WatermarkAdorner

Returns a WatermarkAdorner for a Control, or null if none exists.

HasActualValue ( Control control ) : bool

Returns a value indicating whether a Control has an actual value (where the text property is not null or empty).

RemoveWatermarkAdorner ( Control control ) : void

Removes the WatermarkAdorner from a Control.

TextBoxTextChanged ( object sender, System.Windows.Controls.TextChangedEventArgs e ) : void

Invoked when content changes in a text box control.

UpdateAdornerLayer ( Control control ) : void

Forces the AdornerLayer to re-render.

UpdateWatermark ( Control control ) : void

Updates the WatermarkAdorner on the Control.

Method Details

GetHint() public static method

Returns the value of the HintProperty.
public static GetHint ( Control control ) : object
control System.Windows.Controls.Control A .
return object

GetHintBrush() public static method

Returns the value of the HintBrushProperty.
public static GetHintBrush ( Control control ) : System.Windows.Media.Brush
control System.Windows.Controls.Control A .
return System.Windows.Media.Brush

SetHint() public static method

Sets the value of the HintProperty.
public static SetHint ( Control control, object value ) : void
control System.Windows.Controls.Control A .
value object The value to set.
return void

SetHintBrush() public static method

Sets the value of the HintBrushProperty.
public static SetHintBrush ( Control control, System.Windows.Media.Brush value ) : void
control System.Windows.Controls.Control A .
value System.Windows.Media.Brush The value to set.
return void

Property Details

HintBrushProperty public static property

A DependencyProperty that specifies the foreground of the watermark to be displayed when the control has no actual value and no keyboard focus.
public static DependencyProperty,System.Windows HintBrushProperty
return System.Windows.DependencyProperty

HintProperty public static property

A DependencyProperty that specifies the content of the watermark to be displayed when the control has no actual value and no keyboard focus, typically a string.
public static DependencyProperty,System.Windows HintProperty
return System.Windows.DependencyProperty