![]() ![]() Gets a value that indicates whether at least one touch is pressed over this element. Gets a value that indicates whether at least one touch is captured to this element or to any child elements in its visual tree. Gets a value that indicates whether at least one touch is captured to this element. Gets or sets a value indicating whether this element can be used as the target of a drag-and-drop operation. Gets the rendered height of this element. Gets or sets a value that indicates how the text editing control responds when the user presses the TAB key. Gets or sets a value that indicates how the text editing control responds when the user presses the ENTER key. Identifies the TextWrapping dependency property. Identifies the TextDecorations dependency property. Identifies the TextAlignment dependency property. Identifies the MinLines dependency property. Identifies the MaxLines dependency property. Identifies the MaxLength dependency property. Identifies the CharacterCasing dependency property. Initializes a new instance of the TextBox class. You can find a list of visual properties in the Changing the Visual Structure of a Control section in the Customizing the Appearance of an Existing Control by Creating a ControlTemplate article. Setting a visual property only has an effect if that property is both present in the control's default template and is set by using a TemplateBinding. The default style is determined by which desktop theme is used when the application is running. If a property is set by a default style, the property might change from its default value when the control appears in the application. To see the parts and states that are specific to the TextBox, see TextBox Styles and Templates.ĭependency properties for this control might be set by the control's default style. For more information about creating a ControlTemplate, see Customizing the Appearance of an Existing Control by Creating a ControlTemplate. You can modify the default ControlTemplate to give the control a unique appearance. To apply the same property settings to multiple TextBox controls, use the Style property. See How to: Detect When Text in a TextBox Has Changed for an example. Usually the TextChanged event should be used to detect whenever the text in a TextBox or RichTextBox changes rather then KeyDown as you might expect. To make scrollbars visible, set the VerticalScrollBarVisibility and HorizontalScrollBarVisibility properties to Visible or Auto. Scrollbars are not visible on a TextBox by default. Do not mark the event handled unless you deliberately want to disable TextBox native handling of these events, and be aware that this has notable effects on the control's UI. If you need to respond to these events, listen for the tunneling PreviewMouseUp and PreviewMouseDown events instead, or register the handlers with the HandledEventsToo argument (this latter option is only available through code). Consequently, custom event handlers that listen for MouseUp or MouseDown events from a TextBox will not be called. TextBox has built-in handling for the bubbling MouseUp and MouseDown events. The best way to hide the border around a TextBox is to set the BorderThickness property of the TextBox to 0. Aligning the TextBox within the layout of the page is done with the HorizontalAlignment and VerticalAlignment properties. ![]() Horizontally and vertically aligning text within a TextBox is done with the HorizontalContentAlignment and VerticalContentAlignment properties. For applications that need to accept passwords or other sensitive input, see PasswordBox. For applications that require support for richer content, see RichTextBox. Because of this, application developers should listen for the tunneling version of an event (denoted by the prefix "Preview"). Consequently, some events do not bubble up to the containing control because they are handled by encapsulated child elements. TextBox is a composite control that is composed of several encapsulated components. The following graphic shows an example of a TextBox. TbSettingText.Text = "Initial text contents of the TextBox."Ī TextBox control can contain only unformatted text in its Text property. TbSettingText.Text = "Initial text contents of the TextBox." Although the Extensible Application Markup Language (XAML) version of the example could use the tags around the text of each button's TextBox content, it is not necessary because the TextBox applies the ContentPropertyAttribute attribute to the Text property. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |