Style with Button.BorderBrush is affecting my TextBox

Posted by Qutyquteshweta under WPF on 9/13/2012 | Points: 10 | Views : 1576 | Status : [Member] | Replies : 0
Hi,

I have below code snippet. Here I am using Button.BorderBrush but the style is affecting my TextBox also. Why ? As per my knowledge, textbox should not get RED border. Please clear my doubt.

<Window x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" WindowState="Maximized">
<Window.Resources>
<SolidColorBrush Color="Red" x:Key="solidbrush"/>
<Style x:Key="FontStyle" >
<Setter Property="Control.FontFamily" Value="Calibri"/>
<Setter Property="Control.FontWeight" Value="Bold"/>
<Setter Property="Control.FontSize" Value="12"/>
<Setter Property="Control.Height" Value="70"/>
<Setter Property="Button.BorderBrush" Value="{StaticResource solidbrush}"/>
</Style>
</Window.Resources>
<Grid>
<StackPanel HorizontalAlignment="Left" Margin="202,0,202,365">
<Button Name="SampleButton" Width="60"
Style="{StaticResource FontStyle}"
Content="Button"/>
<TextBox Style="{StaticResource FontStyle}"
Width="70" Height="30" />
</StackPanel>
</Grid>
</Window>


Regards,
Shweta
http://www.shwetalodha.blogspot.com



Responses

(No response found.)

Login to post response