ListBoxStyle.xaml 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <!-- 用于页面编辑的Item样式 -->
  3. <ControlTemplate x:Key="ListBoxItemControlTemplate" TargetType="{x:Type ListBoxItem}">
  4. <Border
  5. x:Name="Bd"
  6. Padding="{TemplateBinding Padding}"
  7. Background="{TemplateBinding Background}"
  8. BorderBrush="{TemplateBinding BorderBrush}"
  9. BorderThickness="{TemplateBinding BorderThickness}"
  10. SnapsToDevicePixels="True">
  11. <ContentPresenter
  12. Content="{TemplateBinding Content}"
  13. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  14. ContentTemplate="{TemplateBinding ContentTemplate}"
  15. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  16. </Border>
  17. <ControlTemplate.Triggers>
  18. <!--<MultiTrigger>
  19. <MultiTrigger.Conditions>
  20. <Condition Property="IsMouseOver" Value="True" />
  21. </MultiTrigger.Conditions>
  22. <Setter TargetName="Bd" Property="Background" Value="#1A000000" />
  23. <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
  24. </MultiTrigger>
  25. <MultiTrigger>
  26. <MultiTrigger.Conditions>
  27. <Condition Property="Selector.IsSelectionActive" Value="False" />
  28. <Condition Property="IsSelected" Value="True" />
  29. </MultiTrigger.Conditions>
  30. -->
  31. <!--<Setter TargetName="Bd" Property="Background" Value="#1A477EDE" />
  32. <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />-->
  33. <!--
  34. </MultiTrigger>
  35. <MultiTrigger>
  36. <MultiTrigger.Conditions>
  37. <Condition Property="Selector.IsSelectionActive" Value="True" />
  38. <Condition Property="IsSelected" Value="True" />
  39. </MultiTrigger.Conditions>
  40. -->
  41. <!--<Setter TargetName="Bd" Property="Background" Value="#1A477EDE" />
  42. <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />-->
  43. <!--
  44. </MultiTrigger>
  45. <Trigger Property="IsEnabled" Value="False">
  46. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  47. </Trigger>-->
  48. </ControlTemplate.Triggers>
  49. </ControlTemplate>
  50. <ControlTemplate x:Key="EditToolsItemControlTemplate" TargetType="{x:Type ListBoxItem}">
  51. <Border x:Name="EditToolsBorder"
  52. Padding="{TemplateBinding Padding}"
  53. Background="{TemplateBinding Background}"
  54. BorderBrush="{TemplateBinding BorderBrush}"
  55. BorderThickness="{TemplateBinding BorderThickness}"
  56. Height="{TemplateBinding Height}"
  57. Width="{TemplateBinding Width}"
  58. SnapsToDevicePixels="True"
  59. >
  60. <ContentPresenter
  61. Content="{TemplateBinding Content}"
  62. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  63. ContentTemplate="{TemplateBinding ContentTemplate}"
  64. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  65. </Border>
  66. <ControlTemplate.Triggers>
  67. <MultiTrigger>
  68. <MultiTrigger.Conditions>
  69. <Condition Property="IsMouseOver" Value="True"></Condition>
  70. </MultiTrigger.Conditions>
  71. <Setter Property="Background" TargetName="EditToolsBorder" Value="#1A477EDE"/>
  72. <Setter Property="BorderBrush" TargetName="EditToolsBorder" Value="Black"/>
  73. </MultiTrigger>
  74. <MultiTrigger>
  75. <MultiTrigger.Conditions>
  76. <Condition Property="Selector.IsSelectionActive" Value="True"/>
  77. <Condition Property="IsSelected" Value="True"/>
  78. </MultiTrigger.Conditions>
  79. <Setter Property="Background" TargetName="EditToolsBorder" Value="#1A477EDE"/>
  80. <Setter Property="BorderBrush" TargetName="EditToolsBorder" Value="Black"/>
  81. </MultiTrigger>
  82. <Trigger Property="IsEnabled" Value="False">
  83. <Setter Property="TextElement.Foreground" TargetName="EditToolsBorder" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  84. </Trigger>
  85. </ControlTemplate.Triggers>
  86. </ControlTemplate>
  87. </ResourceDictionary>