How to remove border from Textbox in WPF?
42,071
Solution 1
Try BorderThickness="0"
<TextBox x:Name="SearchBox" BorderThickness="0" HorizontalAlignment="Left" Height="40" Width="296" Margin="10,0,0,0" TextWrapping="Wrap" VerticalAlignment="Center" SelectionBrush="Black" Background="#00000000" Foreground="#FF5B5B5B" FontSize="25" FontFamily="Segoe UI Light" BorderBrush="#00000000" CaretBrush="#FF6C6C6C"/>
Solution 2
you can remove the border by just setting the BorderBrush property to Transparent.
Related videos on Youtube
![Fᴀʀʜᴀɴ Aɴᴀᴍ](https://i.stack.imgur.com/4800Y.png?s=256&g=1)
Author by
Fᴀʀʜᴀɴ Aɴᴀᴍ
Updated on October 23, 2020Comments
-
Fᴀʀʜᴀɴ Aɴᴀᴍ over 3 years
These borders appear when they are clicked or hovered and don't go until the focus is lost. There are borders on all four sides but since it is embedded in a shorter grid, the top and bottom ones are not visible. How to remove these borders? Please provide an example if possible.
XAML:
<Border x:Name="SearchBorder" BorderThickness="1" HorizontalAlignment="Left" Height="40" Margin="672,34,0,0" VerticalAlignment="Top" Width="355" Background="#3F000000"> <Border.BorderBrush> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#4C000000" Offset="0"/> <GradientStop Color="#3FFFFFFF" Offset="1"/> </LinearGradientBrush> </Border.BorderBrush> <Grid> <TextBox x:Name="SearchBox" HorizontalAlignment="Left" Height="40" Width="296" Margin="10,0,0,0" TextWrapping="Wrap" VerticalAlignment="Center" SelectionBrush="Black" Background="#00000000" Foreground="#FF5B5B5B" FontSize="25" FontFamily="Segoe UI Light" BorderBrush="#00000000" CaretBrush="#FF6C6C6C"/> <TextBlock HorizontalAlignment="Left" Height="23" Margin="320,0,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Center" Width="21" FontFamily="FontAwesome" FontSize="25" Foreground="#FF919191"/> <Rectangle HorizontalAlignment="Left" Margin="311,-2,0,0" Width="1"> <Rectangle.Stroke> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#3F404040" Offset="0"/> <GradientStop Color="#3F686868" Offset="1"/> <GradientStop Color="#59DADADA" Offset="0.502"/> </LinearGradientBrush> </Rectangle.Stroke> </Rectangle> </Grid> </Border>
-
almulo almost 9 yearsThat doesn't look like Combo's default style, so it'd help if you shared your XAML Styles and Templates.
-
Fᴀʀʜᴀɴ Aɴᴀᴍ almost 9 yearsxaml code posted. there are no additional styles
-
almulo almost 9 yearsHave you tried
BorderThickness="0"
?
-
-
Fᴀʀʜᴀɴ Aɴᴀᴍ almost 6 yearsPretty sure that won't work. Check my code it does have BorderBrush set to #00000000 in the XAML