Janmaruko Hōrensō
Janmaruko Hōrensō

Reputation: 89

WPF Change thickness left border textbox

I've to change the thickness of a textbox in WPF, but i don't know how to change only one border.

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"/>

Upvotes: 1

Views: 9688

Answers (2)

<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.

Upvotes: 1

Clemens
Clemens

Reputation: 128060

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>

Upvotes: 5

Related Questions