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.
![textbar textbar](https://image.shutterstock.com/image-vector/set-paper-colorful-banners-shadows-260nw-176816534.jpg)
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.