Meghana B

Meghana B

  • NA
  • 50
  • 10.3k

Background colour not changing in wpf help me

Nov 3 2020 2:30 AM
Hello Team,
Background colour not changing in wpf help me
  1. <Window x:Class="WpfResources.MainWindow"  
  2.         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  3.         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
  4.         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
  5.         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
  6.         xmlns:local="clr-namespace:WpfResources"  
  7.         mc:Ignorable="d"  
  8.         Title="MainWindow" Height="450" Width="800">  
  9.     <Window.Resources>  
  10.         <SolidColorBrush Color="Red" x:Key="ButtonColorRed"></SolidColorBrush>  
  11.     </Window.Resources>  
  12.     <Grid>  
  13.         <Button Width="200" Height="100" Margin="47,68,553,266" Background="{StaticResource ButtonColorRed}" ></Button>  
  14.         <Button Width="200" Height="100" Margin="332,90,268,244" Background="{StaticResource ButtonColorRed}" >  
  15.             <Button.Style>  
  16.                 <Style TargetType="Button">  
  17.                     <Setter Property="Background" Value="Blue">  
  18.                     </Setter>  
  19.                 </Style>  
  20.             </Button.Style>  
  21.         </Button>  
  22.     </Grid>  
  23. </Window>  
Thanks in Advanace
Meghana. 

Answers (2)