WPF 更改厚度左边框文本框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16851001/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WPF Change thickness left border textbox
提问by Gianmarco Spinaci
I've to change the thickness of a textbox in WPF, but i don't know how to change only one border.
我必须在 WPF 中更改文本框的粗细,但我不知道如何仅更改一个边框。
How can i do it?
我该怎么做?
thi is my code
这是我的代码
<TextBox HorizontalAlignment="Left" Height="23" Margin="215,144,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
回答by Clemens
To set for example the thickness of the left border only, you could write either this:
例如,仅设置左边框的粗细,您可以这样写:
<TextBox BorderThickness="10,0,0,0" .../>
or this:
或这个:
<TextBox ...>
<TextBox.BorderThickness>
<Thickness Left="10"/>
</TextBox.BorderThickness>
</TextBox>
回答by PropertyChangedEventHandler
<TextBox HorizontalAlignment="Left" Height="23" BorderBrush="Red" Margin="215,144,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120" BorderThickness="5"/>
Apply Border brush and set BorderThickness="5,0,0,0" to required thickness.
应用边框画笔并将 BorderThickness="5,0,0,0" 设置为所需的厚度。

