I thought that the XAML in WPF would be very powerful and many attributes can be set, such as the rounded corner attribute of the text box. Unfortunately, this attribute does not exist. However, it was unexpectedly discovered that the Border has the CornerRadius attribute. We can use it to set the Border effect of the Border.
The main code of XAML is as follows:
<Border CornerRadius = "5" Height = "35" Margin = "142,137,202,139" BorderThickness = "1" BorderBrush = "# FF737070">
<TextBox Height = "32" Name = "textBox1" Width = "156" Background = "{x: Null}" BorderThickness = "0" FontSize = "22"/>
</Border>
Note that the BorderThickness attribute of Border is to set the Border width of this Border, while that of BorderBrush is the Border color. The TextBox's Background is set to transparent ("{x: Null}"), and BorderThickness is the border of the text box. We can remove it and set it to 0. This is equivalent to hiding the TextBox, but it exists and can still be input. We just use the Border's appearance to replace the TextBox...
The effect is as follows:
Of course, since these attributes can be defined, we can encapsulate them as a dll Control and customize the rounded corner attribute of the control. Then we can use it perfectly...
If you want to reprint it, please indicate the author and the source. Thank you!