Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Property Trigger for Button

<Window x: Class="PropertyTrigger2.Window1"   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   Title="PropertyTrigger2" Height="300" Width="300">   <Window.Resources>     <Style TargetType="{x:Type Button}">       <Style.Triggers>         <Trigger Property="IsMouseOver" Value="True">           <Setter Property="Background" Value="Orange" />         </Trigger>         <Trigger Property="IsFocused" Value="True">           <Setter Property="Background" Value="Red" />         </Trigger>       </Style.Triggers>     </Style>   </Window.Resources>   <Grid>     <Button        VerticalAlignment="Top"       HorizontalAlignment="Stretch"       Height="46"       Name="button"       >       Button     </Button>         <Button        VerticalAlignment="Top"       HorizontalAlignment="Stretch"       Height="46"       Name="otherbutton"       Margin="0,47,0,0"       >       Other Button     </Button>        </Grid>    </Window>