CustomListItemStyle.xaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
  4. >
  5. <Style x:Key="FocusVisual">
  6. <Setter Property="Control.Template">
  7. <Setter.Value>
  8. <ControlTemplate>
  9. <Rectangle Margin="0"
  10. SnapsToDevicePixels="true"
  11. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  12. StrokeDashArray="1 2"
  13. StrokeThickness="0" />
  14. </ControlTemplate>
  15. </Setter.Value>
  16. </Setter>
  17. </Style>
  18. <!-- set SelectedBackgroundColor to Transparent when you do not need the background in selected items -->
  19. <Color x:Key="SelectedBackgroundColor">LightBlue</Color>
  20. <Color x:Key="SelectedUnfocusedColor">AliceBlue</Color>
  21. <!-- set the MouseOverColor to Transparent when you do not need the effect in the unselected items -->
  22. <Color x:Key="MouseOverColor">LightBlue</Color>
  23. <SolidColorBrush x:Key="Item.MouseOver.Background"
  24. Color="LightBlue" />
  25. <SolidColorBrush x:Key="Item.MouseOver.Border"
  26. Color="LightBlue" />
  27. <SolidColorBrush x:Key="Item.SelectedInactive.Background"
  28. Color="AliceBlue" />
  29. <SolidColorBrush x:Key="Item.SelectedInactive.Border"
  30. Color="AliceBlue" />
  31. <SolidColorBrush x:Key="Item.SelectedActive.Background"
  32. Color="Beige" />
  33. <SolidColorBrush x:Key="Item.SelectedActive.Border"
  34. Color="Beige" />
  35. <Style x:Key="ListBoxItemStyle"
  36. TargetType="{x:Type customControl:ListItemQuickTool}">
  37. <Setter Property="SnapsToDevicePixels"
  38. Value="True" />
  39. <Setter Property="FocusVisualStyle"
  40. Value="{x:Null}" />
  41. <Setter Property="Template">
  42. <Setter.Value>
  43. <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
  44. <Border x:Name="Border"
  45. Margin="0,0,0,16"
  46. BorderThickness="1"
  47. Background="Transparent"
  48. SnapsToDevicePixels="true">
  49. <Border.BorderBrush>
  50. <SolidColorBrush Color="#000000" Opacity="0.05"/>
  51. </Border.BorderBrush>
  52. <ContentPresenter />
  53. </Border>
  54. <ControlTemplate.Triggers>
  55. <MultiTrigger>
  56. <MultiTrigger.Conditions>
  57. <Condition Property="IsOverModular"
  58. Value="True" />
  59. </MultiTrigger.Conditions>
  60. <Setter TargetName="Border"
  61. Property="Background"
  62. Value="{StaticResource Item.MouseOver.Background}" />
  63. <Setter TargetName="Border"
  64. Property="BorderBrush"
  65. Value="{StaticResource Item.MouseOver.Border}" />
  66. </MultiTrigger>
  67. </ControlTemplate.Triggers>
  68. </ControlTemplate>
  69. </Setter.Value>
  70. </Setter>
  71. <Style.Triggers />
  72. </Style>
  73. <Style x:Key="MoreListBoxItemStyle"
  74. TargetType="{x:Type customControl:ListItemQuickTool}">
  75. <Setter Property="SnapsToDevicePixels"
  76. Value="True" />
  77. <Setter Property="Template">
  78. <Setter.Value>
  79. <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
  80. <Border x:Name="Border" CornerRadius="4" Margin="0,0,0,16" BorderThickness="1"
  81. Background="Transparent"
  82. SnapsToDevicePixels="False">
  83. <Border.BorderBrush>
  84. <SolidColorBrush Color="#000000" Opacity="0.05"/>
  85. </Border.BorderBrush>
  86. <ContentPresenter />
  87. </Border>
  88. <ControlTemplate.Triggers>
  89. <MultiTrigger>
  90. <MultiTrigger.Conditions>
  91. <Condition Property="IsSelected"
  92. Value="true" />
  93. </MultiTrigger.Conditions>
  94. <MultiTrigger.Setters>
  95. <Setter TargetName="Border"
  96. Property="Background"
  97. Value="LightGoldenrodYellow" />
  98. </MultiTrigger.Setters>
  99. </MultiTrigger>
  100. </ControlTemplate.Triggers>
  101. </ControlTemplate>
  102. </Setter.Value>
  103. </Setter>
  104. </Style>
  105. </ResourceDictionary>