Table of Contents

Class MaskedTextBoxBehavior

Namespace
HeBianGu.Base.WpfBase
Assembly
HeBianGu.Base.WpfBase.dll

显示输入内容 目前测试输入法输入时有问题

public class MaskedTextBoxBehavior : Behavior<TextBox>, IAnimatable, IAttachedObject
Inheritance
MaskedTextBoxBehavior
Implements
Inherited Members
Extension Methods

Fields

MaskProperty

This property serves a dual purpose. First, it allows the behavior to be used as a traditional attached property behavior - without use of the Blend tool. Second, it acts as a local property to store the expression.

public static DependencyProperty MaskProperty

Field Value

DependencyProperty

Properties

Mask

Mask to use for the regular expression.

public string Mask { get; set; }

Property Value

string

Methods

GetMask(TextBox)

Returns whether MaskedTextBoxBehavior is enabled via attached property

public static string GetMask(TextBox textBox)

Parameters

textBox TextBox

Returns

string

Regular Expression Mask

OnAttached()

This attaches the property handlers - PreviewKeyDown and Clipboard support.

protected override void OnAttached()

OnDetaching()

This removes all our handlers.

protected override void OnDetaching()

SetMask(TextBox, string)

Adds MaskedTextBoxBehavior to TextBox

public static void SetMask(TextBox textBox, string value)

Parameters

textBox TextBox

TextBox to apply

value string

True/False