Triggers.xaml
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:2k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. <Page xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  2.     
  3. <Page.Resources>
  4. <Style x:Key="BaseRectangle" TargetType="Rectangle">
  5. <Style.Triggers>
  6. <Trigger Property="IsMouseOver" Value="True">
  7. <Trigger.Setters>
  8. <Setter Property="Margin" Value="8, 8, 0, 0"/>
  9. </Trigger.Setters>
  10. </Trigger>
  11. <Trigger Property="Fill" Value="Green">
  12. <Trigger.Setters>
  13. <Setter Property="Stroke" Value="Red"/>
  14. </Trigger.Setters>
  15. </Trigger>
  16. </Style.Triggers>
  17. </Style>
  18. <Style x:Key="{x:Type Rectangle}" TargetType="Rectangle" BasedOn="{StaticResource BaseRectangle}">
  19. <Setter Property="Margin" Value="4"/>
  20. <Setter Property="Fill" Value="Gray"/>
  21. <Style.Triggers>
  22. <Trigger Property="Margin" Value="8, 8, 0, 0">
  23. <Trigger.Setters>
  24. <Setter Property="Fill" Value="Green"/>
  25. </Trigger.Setters>
  26. </Trigger>
  27. </Style.Triggers>
  28. </Style>
  29. <Style x:Key="{x:Type Button}" TargetType="Button">
  30. <Style.Triggers>
  31. <Trigger Property="IsMouseOver" Value="True">
  32. <Trigger.Setters>
  33. <Setter Property="TextElement.FontSize" Value="15"/>
  34. </Trigger.Setters>
  35. </Trigger>
  36. <Trigger Property="IsPressed" Value="True">
  37. <Trigger.Setters>
  38. <Setter Property="TextElement.FontWeight" Value="Bold"/>
  39. </Trigger.Setters>
  40. </Trigger>
  41. </Style.Triggers>
  42. </Style>
  43. <Style x:Key="{x:Type StackPanel}" TargetType="StackPanel">
  44. <Setter Property="Background" Value="#eeeeee"/>
  45. <Style.Triggers>
  46. <Trigger Property="IsMouseOver" Value="True">
  47. <Trigger.Setters>
  48. <Setter Property="Background" Value="#dddddd"/>
  49. </Trigger.Setters>
  50. </Trigger>
  51. </Style.Triggers>
  52. </Style>
  53. </Page.Resources>
  54. <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
  55. <Rectangle Width="100" Height="100"/>
  56. <StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
  57. <Button Content="Button" VerticalAlignment="Center" />
  58. <Button Content="Button" VerticalAlignment="Center" />
  59. <Button Content="Button" VerticalAlignment="Center" />
  60. <Button Content="Button" VerticalAlignment="Center" />
  61. </StackPanel>
  62. </StackPanel>
  63. </Page>