Triggers.xaml
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:2k
- <Page xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
-
- <Page.Resources>
- <Style x:Key="BaseRectangle" TargetType="Rectangle">
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Trigger.Setters>
- <Setter Property="Margin" Value="8, 8, 0, 0"/>
- </Trigger.Setters>
- </Trigger>
- <Trigger Property="Fill" Value="Green">
- <Trigger.Setters>
- <Setter Property="Stroke" Value="Red"/>
- </Trigger.Setters>
- </Trigger>
- </Style.Triggers>
- </Style>
- <Style x:Key="{x:Type Rectangle}" TargetType="Rectangle" BasedOn="{StaticResource BaseRectangle}">
- <Setter Property="Margin" Value="4"/>
- <Setter Property="Fill" Value="Gray"/>
- <Style.Triggers>
- <Trigger Property="Margin" Value="8, 8, 0, 0">
- <Trigger.Setters>
- <Setter Property="Fill" Value="Green"/>
- </Trigger.Setters>
- </Trigger>
- </Style.Triggers>
- </Style>
-
- <Style x:Key="{x:Type Button}" TargetType="Button">
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Trigger.Setters>
- <Setter Property="TextElement.FontSize" Value="15"/>
- </Trigger.Setters>
- </Trigger>
- <Trigger Property="IsPressed" Value="True">
- <Trigger.Setters>
- <Setter Property="TextElement.FontWeight" Value="Bold"/>
- </Trigger.Setters>
- </Trigger>
- </Style.Triggers>
- </Style>
- <Style x:Key="{x:Type StackPanel}" TargetType="StackPanel">
- <Setter Property="Background" Value="#eeeeee"/>
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Trigger.Setters>
- <Setter Property="Background" Value="#dddddd"/>
- </Trigger.Setters>
- </Trigger>
- </Style.Triggers>
- </Style>
- </Page.Resources>
-
- <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Rectangle Width="100" Height="100"/>
- <StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Button Content="Button" VerticalAlignment="Center" />
- <Button Content="Button" VerticalAlignment="Center" />
- <Button Content="Button" VerticalAlignment="Center" />
- <Button Content="Button" VerticalAlignment="Center" />
- </StackPanel>
- </StackPanel>
- </Page>