Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Presentation.Controls.TextBox Class Reference

An implementation of the TextBoxBase control that provides additional features such as a proper validation/cancellation workflow, and a watermark to display when the text is empty. More...

Inheritance diagram for SiliconStudio.Presentation.Controls.TextBox:
SiliconStudio.Presentation.Controls.TextBoxBase

Public Member Functions

 TextBox ()
 
override void OnApplyTemplate ()
 
- Public Member Functions inherited from SiliconStudio.Presentation.Controls.TextBoxBase
 TextBoxBase ()
 
void Validate ()
 Validates the current changes in the TextBox. More...
 
void Cancel ()
 Cancels the current changes in the TextBox. More...
 

Static Public Attributes

static readonly DependencyProperty UseTimedValidationProperty = DependencyProperty.Register("UseTimedValidation", typeof(bool), typeof(TextBox), new PropertyMetadata(false, OnUseTimedValidationPropertyChanged))
 Identifies the UseTimedValidation dependency property. More...
 
static readonly DependencyProperty ValidationDelayProperty = DependencyProperty.Register("ValidationDelay", typeof(int), typeof(TextBox), new PropertyMetadata(500))
 Identifies the ValidationDelay dependency property. More...
 
static readonly
DependencyPropertyKey 
TrimmedTextPropertyKey = DependencyProperty.RegisterReadOnly("TrimmedText", typeof(string), typeof(TextBox), new PropertyMetadata(""))
 Identifies the TrimmedText dependency property. More...
 
static readonly DependencyProperty WatermarkContentProperty = DependencyProperty.Register("WatermarkContent", typeof(object), typeof(TextBox), new PropertyMetadata(null))
 Identifies the WatermarkContent dependency property. More...
 
static readonly DependencyProperty WatermarkContentTemplateProperty = DependencyProperty.Register("WatermarkContentTemplate", typeof(DataTemplate), typeof(TextBox), new PropertyMetadata(null))
 Identifies the WatermarkContentTemplate dependency property. More...
 
static readonly DependencyProperty TextTrimmingProperty = DependencyProperty.Register("TextTrimming", typeof(TextTrimming), typeof(TextBox), new PropertyMetadata(TextTrimming.None))
 Identifies the TextTrimming dependency property. More...
 
static readonly DependencyProperty TrimmingSourceProperty = DependencyProperty.Register("TrimmingSource", typeof(TrimmingSource), typeof(TextBox), new PropertyMetadata(TrimmingSource.End))
 Identifies the TrimmingSource dependency property. More...
 
static readonly DependencyProperty TrimmedTextProperty = TrimmedTextPropertyKey.DependencyProperty
 Identifies the TrimmedText dependency property. More...
 
- Static Public Attributes inherited from SiliconStudio.Presentation.Controls.TextBoxBase
static readonly DependencyProperty GetFocusOnLoadProperty = DependencyProperty.Register("GetFocusOnLoad", typeof(bool), typeof(TextBoxBase), new PropertyMetadata(false))
 Identifies the GetFocusOnLoad dependency property. More...
 
static readonly DependencyProperty SelectAllOnFocusProperty = DependencyProperty.Register("SelectAllOnFocus", typeof(bool), typeof(TextBoxBase), new PropertyMetadata(false))
 Identifies the SelectAllOnFocus dependency property. More...
 
static readonly DependencyProperty ValidateWithEnterProperty = DependencyProperty.Register("ValidateWithEnter", typeof(bool), typeof(TextBoxBase), new PropertyMetadata(true))
 Identifies the ValidateWithEnter dependency property. More...
 
static readonly DependencyProperty ValidateOnTextChangeProperty = DependencyProperty.Register("ValidateOnTextChange", typeof(bool), typeof(TextBoxBase), new PropertyMetadata(false))
 Identifies the ValidateOnTextChange dependency property. More...
 
static readonly DependencyProperty ValidateOnLostFocusProperty = DependencyProperty.Register("ValidateOnLostFocus", typeof(bool), typeof(TextBoxBase), new PropertyMetadata(true, OnLostFocusActionChanged))
 Identifies the ValidateOnLostFocus dependency property. More...
 
static readonly DependencyProperty CancelWithEscapeProperty = DependencyProperty.Register("CancelWithEscape", typeof(bool), typeof(TextBoxBase), new PropertyMetadata(true))
 Identifies the CancelWithEscape dependency property. More...
 
static readonly DependencyProperty CancelOnLostFocusProperty = DependencyProperty.Register("CancelOnLostFocus", typeof(bool), typeof(TextBoxBase), new PropertyMetadata(false, OnLostFocusActionChanged))
 Identifies the CancelOnLostFocus dependency property. More...
 
static readonly DependencyProperty ValidateCommandProperty = DependencyProperty.Register("ValidateCommand", typeof(ICommand), typeof(TextBoxBase))
 Identifies the ValidateCommand dependency property. More...
 
static readonly DependencyProperty ValidateCommandParameterProprty = DependencyProperty.Register("ValidateCommandParameter", typeof(object), typeof(TextBoxBase))
 Identifies the ValidateCommandParameter dependency property. More...
 
static readonly DependencyProperty CancelCommandProperty = DependencyProperty.Register("CancelCommand", typeof(ICommand), typeof(TextBoxBase))
 Identifies the CancelCommand dependency property. More...
 
static readonly DependencyProperty CancelCommandParameterProprty = DependencyProperty.Register("CancelCommandParameter", typeof(object), typeof(TextBoxBase))
 Identifies the CancelCommandParameter dependency property. More...
 
static readonly RoutedEvent ValidatingEvent = EventManager.RegisterRoutedEvent("Validating", RoutingStrategy.Bubble, typeof(CancelRoutedEventHandler), typeof(TextBox))
 Raised just before the TextBox changes are validated. This event is cancellable More...
 
static readonly RoutedEvent ValidatedEvent = EventManager.RegisterRoutedEvent("Validated", RoutingStrategy.Bubble, typeof(ValidationRoutedEventHandler<string>), typeof(TextBox))
 Raised when TextBox changes have been validated. More...
 
static readonly RoutedEvent CancelledEvent = EventManager.RegisterRoutedEvent("Cancelled", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TextBox))
 Raised when the TextBox changes are cancelled. More...
 

Protected Member Functions

override void OnTextChanged (string oldValue, string newValue)
 Raised when the text of the TextBox changes. More...
 
override Size ArrangeOverride (Size arrangeBounds)
 
- Protected Member Functions inherited from SiliconStudio.Presentation.Controls.TextBoxBase
virtual void OnValidating (CancelRoutedEventArgs e)
 Raised when the text of the TextBox is being validated. More...
 
virtual void OnValidated ()
 Raised when the current changes have has been validated. More...
 
virtual void OnCancelled ()
 Raised when the current changes have been cancelled. More...
 
virtual string CoerceTextForValidation (string baseValue)
 Coerces the text during the validation process. This method is invoked by Validate. More...
 
override void OnPreviewKeyDown (KeyEventArgs e)
 
override void OnGotKeyboardFocus (KeyboardFocusChangedEventArgs e)
 
override void OnMouseDown (MouseButtonEventArgs e)
 
override void OnLostKeyboardFocus (KeyboardFocusChangedEventArgs e)
 

Properties

static RoutedCommand ClearTextCommand [get, set]
 Clears the current System.Windows.Controls.TextBox.Text of a text box. More...
 
bool UseTimedValidation [get, set]
 Gets or sets whether the text should be automatically validated after a delay defined by the ValidationDelay property. More...
 
int ValidationDelay [get, set]
 Gets or sets the amount of time before a validation of input text happens, in milliseconds. Every change to the TextBox.Text property reset the timer to this value. More...
 
string TrimmedText [get, set]
 Gets the trimmed text to display when the control does not have the focus, depending of the value of the TextTrimming property. More...
 
object WatermarkContent [get, set]
 Gets or sets the content to display when the TextBox is empty. More...
 
DataTemplate WatermarkContentTemplate [get, set]
 Gets or sets the template of the content to display when the TextBox is empty. More...
 
TextTrimming TextTrimming [get, set]
 Gets or sets how to trim the text when the control does not have the focus. More...
 
TrimmingSource TrimmingSource [get, set]
 Gets or sets the source position of the text trimming when the control does not have the focus. More...
 
string WordSeparators [get, set]
 Gets or sets the charcters used to separate word when computing trimming using System.Windows.TextTrimming.WordEllipsis. More...
 
- Properties inherited from SiliconStudio.Presentation.Controls.TextBoxBase
bool HasText [get, set]
 Gets whether this TextBox contains a non-empty text. More...
 
bool GetFocusOnLoad [get, set]
 Gets or sets whether the associated text box should get keyboard focus when this behavior is attached. More...
 
bool SelectAllOnFocus [get, set]
 Gets or sets whether the text of the TextBox must be selected when the control gets focus. More...
 
bool ValidateWithEnter [get, set]
 Gets or sets whether the validation should happen when the user press Enter. More...
 
bool ValidateOnTextChange [get, set]
 Gets or sets whether the validation should happen as soon as the TextBox.Text is changed. More...
 
bool ValidateOnLostFocus [get, set]
 Gets or sets whether the validation should happen when the control losts focus. More...
 
bool CancelWithEscape [get, set]
 Gets or sets whether the cancellation should happen when the user press Escape. More...
 
bool CancelOnLostFocus [get, set]
 Gets or sets whether the cancellation should happen when the control losts focus. More...
 
ICommand ValidateCommand [get, set]
 Gets or sets the command to execute when the validation occurs. More...
 
object ValidateCommandParameter [get, set]
 Gets or sets the parameter of the command to execute when the validation occurs. More...
 
ICommand CancelCommand [get, set]
 Gets or sets the command to execute when the cancellation occurs. More...
 
object CancelCommandParameter [get, set]
 Gets or sets the parameter of the command to execute when the cancellation occurs. More...
 
CancelRoutedEventHandler Validating
 Raised just before the TextBox changes are validated. This event is cancellable More...
 
ValidationRoutedEventHandler
< string > 
Validated
 Raised when TextBox changes have been validated. More...
 
RoutedEventHandler Cancelled
 Raised when the TextBox changes are cancelled. More...
 

Detailed Description

An implementation of the TextBoxBase control that provides additional features such as a proper validation/cancellation workflow, and a watermark to display when the text is empty.

Definition at line 29 of file TextBox.cs.

Constructor & Destructor Documentation

SiliconStudio.Presentation.Controls.TextBox.TextBox ( )

Definition at line 86 of file TextBox.cs.

Member Function Documentation

override Size SiliconStudio.Presentation.Controls.TextBox.ArrangeOverride ( Size  arrangeBounds)
protected

Definition at line 172 of file TextBox.cs.

override void SiliconStudio.Presentation.Controls.TextBox.OnApplyTemplate ( )

Definition at line 136 of file TextBox.cs.

override void SiliconStudio.Presentation.Controls.TextBox.OnTextChanged ( string  oldValue,
string  newValue 
)
protectedvirtual

Raised when the text of the TextBox changes.

Parameters
oldValueThe old value of the TextBox.Text property.
newValueThe new value of the TextBox.Text property.

Reimplemented from SiliconStudio.Presentation.Controls.TextBoxBase.

Definition at line 150 of file TextBox.cs.

Member Data Documentation

readonly DependencyProperty SiliconStudio.Presentation.Controls.TextBox.TextTrimmingProperty = DependencyProperty.Register("TextTrimming", typeof(TextTrimming), typeof(TextBox), new PropertyMetadata(TextTrimming.None))
static

Identifies the TextTrimming dependency property.

Definition at line 62 of file TextBox.cs.

readonly DependencyProperty SiliconStudio.Presentation.Controls.TextBox.TrimmedTextProperty = TrimmedTextPropertyKey.DependencyProperty
static

Identifies the TrimmedText dependency property.

Definition at line 72 of file TextBox.cs.

readonly DependencyPropertyKey SiliconStudio.Presentation.Controls.TextBox.TrimmedTextPropertyKey = DependencyProperty.RegisterReadOnly("TrimmedText", typeof(string), typeof(TextBox), new PropertyMetadata(""))
static

Identifies the TrimmedText dependency property.

Definition at line 47 of file TextBox.cs.

readonly DependencyProperty SiliconStudio.Presentation.Controls.TextBox.TrimmingSourceProperty = DependencyProperty.Register("TrimmingSource", typeof(TrimmingSource), typeof(TextBox), new PropertyMetadata(TrimmingSource.End))
static

Identifies the TrimmingSource dependency property.

Definition at line 67 of file TextBox.cs.

readonly DependencyProperty SiliconStudio.Presentation.Controls.TextBox.UseTimedValidationProperty = DependencyProperty.Register("UseTimedValidation", typeof(bool), typeof(TextBox), new PropertyMetadata(false, OnUseTimedValidationPropertyChanged))
static

Identifies the UseTimedValidation dependency property.

Definition at line 37 of file TextBox.cs.

readonly DependencyProperty SiliconStudio.Presentation.Controls.TextBox.ValidationDelayProperty = DependencyProperty.Register("ValidationDelay", typeof(int), typeof(TextBox), new PropertyMetadata(500))
static

Identifies the ValidationDelay dependency property.

Definition at line 42 of file TextBox.cs.

readonly DependencyProperty SiliconStudio.Presentation.Controls.TextBox.WatermarkContentProperty = DependencyProperty.Register("WatermarkContent", typeof(object), typeof(TextBox), new PropertyMetadata(null))
static

Identifies the WatermarkContent dependency property.

Definition at line 52 of file TextBox.cs.

readonly DependencyProperty SiliconStudio.Presentation.Controls.TextBox.WatermarkContentTemplateProperty = DependencyProperty.Register("WatermarkContentTemplate", typeof(DataTemplate), typeof(TextBox), new PropertyMetadata(null))
static

Identifies the WatermarkContentTemplate dependency property.

Definition at line 57 of file TextBox.cs.

Property Documentation

RoutedCommand SiliconStudio.Presentation.Controls.TextBox.ClearTextCommand
staticgetset

Clears the current System.Windows.Controls.TextBox.Text of a text box.

Definition at line 77 of file TextBox.cs.

TextTrimming SiliconStudio.Presentation.Controls.TextBox.TextTrimming
getset

Gets or sets how to trim the text when the control does not have the focus.

Definition at line 123 of file TextBox.cs.

string SiliconStudio.Presentation.Controls.TextBox.TrimmedText
getset

Gets the trimmed text to display when the control does not have the focus, depending of the value of the TextTrimming property.

Definition at line 108 of file TextBox.cs.

TrimmingSource SiliconStudio.Presentation.Controls.TextBox.TrimmingSource
getset

Gets or sets the source position of the text trimming when the control does not have the focus.

Definition at line 128 of file TextBox.cs.

bool SiliconStudio.Presentation.Controls.TextBox.UseTimedValidation
getset

Gets or sets whether the text should be automatically validated after a delay defined by the ValidationDelay property.

Definition at line 96 of file TextBox.cs.

int SiliconStudio.Presentation.Controls.TextBox.ValidationDelay
getset

Gets or sets the amount of time before a validation of input text happens, in milliseconds. Every change to the TextBox.Text property reset the timer to this value.

The default value is 500 milliseconds.

Definition at line 103 of file TextBox.cs.

object SiliconStudio.Presentation.Controls.TextBox.WatermarkContent
getset

Gets or sets the content to display when the TextBox is empty.

Definition at line 113 of file TextBox.cs.

DataTemplate SiliconStudio.Presentation.Controls.TextBox.WatermarkContentTemplate
getset

Gets or sets the template of the content to display when the TextBox is empty.

Definition at line 118 of file TextBox.cs.

string SiliconStudio.Presentation.Controls.TextBox.WordSeparators
getset

Gets or sets the charcters used to separate word when computing trimming using System.Windows.TextTrimming.WordEllipsis.

Definition at line 133 of file TextBox.cs.


The documentation for this class was generated from the following file: