DataGridMaskedStringColumn Class
Represents a base class for data-bound columns for use in a DataGrid that utilize MaskedTextBox controls.
public class DataGridMaskedStringColumn : DataGridBoundColumnBase
- Inheritance:
- object DataGridColumn DataGridBoundColumn DataGridBoundColumnBase object
Constructors
DataGridMaskedStringColumn()
Initializes an instance of the class.
public DataGridMaskedStringColumn()
Properties
DefaultEditingElementStyle
The default value for the EditingElementStyleProperty property.
DefaultElementStyle
The default value for the EditingElementStyleProperty dependency property.
IsCaseAutoCorrected
Indicates whether characters entered will have their case auto-corrected to match the defined mask.
public bool IsCaseAutoCorrected { get; set; }
Property Value
- bool:
trueif characters entered will have their case auto-corrected to match the defined mask; otherwise,false. The default value isfalse.
Remarks
When this property is set to true, the IsCaseSensitive property is ignored.
IsCaseSensitive
Indicates whether the mask is case sensitive.
public bool IsCaseSensitive { get; set; }
Property Value
- bool:
trueif the mask is case sensitive; otherwise,false. The default value isfalse.
Remarks
When the IsCaseAutoCorrected property is set to true, this property is ignored.
Mask
The text that designates the input mask.
MaskKind
The kind of input mask.
PromptChar
The character used to indicate required input.
PromptVisibility
The visibility of mask prompts.
public MaskPromptVisibility PromptVisibility { get; set; }
Property Value
- MaskPromptVisibility:
The default value is FocusedOnly.
Methods
ApplyStandardValues(FrameworkElement)
Applies standard values to the specified target element.
protected virtual void ApplyStandardValues(FrameworkElement targetElement)
| Parameter | Type | Description |
|---|---|---|
| targetElement | FrameworkElement | The target element. |
CommitCellEdit(FrameworkElement)
Performs any required validation before exiting cell editing mode.
protected override bool CommitCellEdit(FrameworkElement editingElement)
| Parameter | Type | Description |
|---|---|---|
| editingElement | FrameworkElement | The element that the column displays for a cell in editing mode. |
Returns
- bool:
trueif no validation errors are found; otherwise,false.
GenerateEditingElement(DataGridCell, object)
When overridden in a derived class, gets an editing element that is bound to the Binding property value of the column.
protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
| Parameter | Type | Description |
|---|---|---|
| cell | DataGridCell | The cell that will contain the generated element. |
| dataItem | object | The data item that is represented by the row that contains the intended cell. |
Returns
- FrameworkElement:
A new editing element that is bound to the Binding property value of the column.
GenerateElement(DataGridCell, object)
When overridden in a derived class, gets a read-only element that is bound to the Binding property value of the column.
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
| Parameter | Type | Description |
|---|---|---|
| cell | DataGridCell | The cell that will contain the generated element. |
| dataItem | object | The data item that is represented by the row that contains the intended cell. |
Returns
- FrameworkElement:
A new read-only element that is bound to the Binding property value of the column.
GenerateMaskedTextBox(bool, DataGridCell)
Generates an instance of a MaskedTextBox object.
protected virtual MaskedTextBox GenerateMaskedTextBox(bool isEditing, DataGridCell cell)
| Parameter | Type | Description |
|---|---|---|
| isEditing | bool | Whether the text box will be used for editing. |
| cell | DataGridCell | The cell. |
Returns
PrepareCellForEdit(FrameworkElement, RoutedEventArgs)
When overridden in a derived class, sets cell content as needed for editing.
protected override object? PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs)
| Parameter | Type | Description |
|---|---|---|
| editingElement | FrameworkElement | The element that the column displays for a cell in editing mode. |
| editingEventArgs | RoutedEventArgs | Information about the user gesture that is causing a cell to enter editing mode. |
Returns
- object:
When returned by a derived class, the unedited cell value. This implementation returns
nullin all cases.
Fields
IsCaseAutoCorrectedProperty
Defines the IsCaseAutoCorrected property.
public static readonly DependencyProperty IsCaseAutoCorrectedProperty
IsCaseSensitiveProperty
Defines the IsCaseSensitive property.
public static readonly DependencyProperty IsCaseSensitiveProperty
MaskKindProperty
Defines the MaskKind property.
public static readonly DependencyProperty MaskKindProperty
MaskProperty
Defines the Mask property.
public static readonly DependencyProperty MaskProperty
PromptCharProperty
Defines the PromptChar property.
public static readonly DependencyProperty PromptCharProperty
PromptVisibilityProperty
Defines the PromptVisibility property.
public static readonly DependencyProperty PromptVisibilityProperty
Inherited Members
- DataGridBoundColumnBase.ApplyBinding(FrameworkElement, DependencyProperty)
- DataGridBoundColumnBase.ApplyValue(DependencyProperty, FrameworkElement, DependencyProperty)
- DataGridBoundColumnBase.RefreshCellContent(FrameworkElement, string)