ListBoxStyle.xaml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. CornerRadius="{StaticResource border-radius.4}"
  11. FocusVisualStyle="{x:Null}"
  12. SnapsToDevicePixels="True">
  13. <ContentPresenter
  14. Margin="16,8"
  15. Content="{TemplateBinding Content}"
  16. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  17. ContentTemplate="{TemplateBinding ContentTemplate}"
  18. FocusVisualStyle="{x:Null}"
  19. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  20. </Border>
  21. <ControlTemplate.Triggers>
  22. <MultiTrigger>
  23. <MultiTrigger.Conditions>
  24. <Condition Property="IsMouseOver" Value="True" />
  25. </MultiTrigger.Conditions>
  26. <Setter TargetName="Bd" Property="Background" Value="Transparent" />
  27. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.sys.border.accent.lv2}" />
  28. </MultiTrigger>
  29. <MultiTrigger>
  30. <MultiTrigger.Conditions>
  31. <Condition Property="Selector.IsSelectionActive" Value="False" />
  32. <Condition Property="IsSelected" Value="True" />
  33. </MultiTrigger.Conditions>
  34. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv1}" />
  35. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.sys.border.accent.lv2}" />
  36. </MultiTrigger>
  37. <MultiTrigger>
  38. <MultiTrigger.Conditions>
  39. <Condition Property="Selector.IsSelectionActive" Value="True" />
  40. <Condition Property="IsSelected" Value="True" />
  41. </MultiTrigger.Conditions>
  42. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv1}" />
  43. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.sys.border.accent.lv2}" />
  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. <!-- 用于BOTA Thunmbnail的Item样式 -->
  51. <ControlTemplate x:Key="BOTAListBoxItemTemplate" TargetType="{x:Type ListBoxItem}">
  52. <Border
  53. x:Name="Bd"
  54. Padding="{TemplateBinding Padding}"
  55. Background="{TemplateBinding Background}"
  56. BorderBrush="{TemplateBinding BorderBrush}"
  57. BorderThickness="{TemplateBinding BorderThickness}"
  58. CornerRadius="{StaticResource border-radius.4}"
  59. FocusVisualStyle="{x:Null}"
  60. SnapsToDevicePixels="True">
  61. <ContentPresenter
  62. Margin="16,8"
  63. Content="{TemplateBinding Content}"
  64. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  65. ContentTemplate="{TemplateBinding ContentTemplate}"
  66. FocusVisualStyle="{x:Null}"
  67. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  68. </Border>
  69. <ControlTemplate.Triggers>
  70. <MultiTrigger>
  71. <MultiTrigger.Conditions>
  72. <Condition Property="IsMouseOver" Value="True" />
  73. </MultiTrigger.Conditions>
  74. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
  75. <!--<Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.sys.border.accent.lv2}" />-->
  76. </MultiTrigger>
  77. <MultiTrigger>
  78. <MultiTrigger.Conditions>
  79. <Condition Property="Selector.IsSelectionActive" Value="False" />
  80. <Condition Property="IsSelected" Value="True" />
  81. </MultiTrigger.Conditions>
  82. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  83. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  84. </MultiTrigger>
  85. <MultiTrigger>
  86. <MultiTrigger.Conditions>
  87. <Condition Property="Selector.IsSelectionActive" Value="True" />
  88. <Condition Property="IsSelected" Value="True" />
  89. </MultiTrigger.Conditions>
  90. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  91. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  92. </MultiTrigger>
  93. <Trigger Property="IsEnabled" Value="False">
  94. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  95. </Trigger>
  96. </ControlTemplate.Triggers>
  97. </ControlTemplate>
  98. <ControlTemplate x:Key="EditToolsItemControlTemplate" TargetType="{x:Type ListBoxItem}">
  99. <Border
  100. x:Name="EditToolsBorder"
  101. Width="{TemplateBinding Width}"
  102. Height="{TemplateBinding Height}"
  103. Padding="{TemplateBinding Padding}"
  104. Background="{TemplateBinding Background}"
  105. BorderBrush="{TemplateBinding BorderBrush}"
  106. BorderThickness="{TemplateBinding BorderThickness}"
  107. SnapsToDevicePixels="True">
  108. <ContentPresenter
  109. Content="{TemplateBinding Content}"
  110. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  111. ContentTemplate="{TemplateBinding ContentTemplate}"
  112. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  113. </Border>
  114. <ControlTemplate.Triggers>
  115. <MultiTrigger>
  116. <MultiTrigger.Conditions>
  117. <Condition Property="IsMouseOver" Value="True" />
  118. </MultiTrigger.Conditions>
  119. <Setter TargetName="EditToolsBorder" Property="Background" Value="#1A477EDE" />
  120. <Setter TargetName="EditToolsBorder" Property="BorderBrush" Value="Black" />
  121. </MultiTrigger>
  122. <MultiTrigger>
  123. <MultiTrigger.Conditions>
  124. <Condition Property="Selector.IsSelectionActive" Value="True" />
  125. <Condition Property="IsSelected" Value="True" />
  126. </MultiTrigger.Conditions>
  127. <Setter TargetName="EditToolsBorder" Property="Background" Value="#1A477EDE" />
  128. <Setter TargetName="EditToolsBorder" Property="BorderBrush" Value="Black" />
  129. </MultiTrigger>
  130. <Trigger Property="IsEnabled" Value="False">
  131. <Setter TargetName="EditToolsBorder" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  132. </Trigger>
  133. </ControlTemplate.Triggers>
  134. </ControlTemplate>
  135. </ResourceDictionary>