![]() ![]() You may use any brush to fill the border. The Background and Foreground properties of the TextBox set the background and foreground colors of a TextBox. The code snippet in Listing 3 uses a linear gradient brush to draw the border with a combination of red and blue color. The BorderBrush property of the TextBox sets a brush to draw the border of a TextBox. The code snippet in Listing 2 sets the position of the TextBox control in the left top corner of the page. We can place a TextBox control where we want by using the Margin, VerticalAlignment and HorizontalAlignment attributes that sets the margin, vertical alignment, and horizontal alignment of a control. ![]() The code snippet in Listing 1 creates a TextBox control and sets the name, height, width, and content of a TextBox control.Īs you can see from Figure 1, by default the TextBox is place in the center of the page. The x:Name attribute represents the name of the control, which is a unique identifier of a control. The Text property of the TextBox element sets the content of a TextBox. The Width and Height attributes of the TextBox element represent the width and the height of a TextBox. ![]() The TextBox element represents a WPF TextBox control in XAML. This article demonstrates how to create and use a TextBox control in WPF using XAML and C#.
0 Comments
Leave a Reply. |