CustomListItemStyle.xaml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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,30"
  46. Background="AliceBlue"
  47. SnapsToDevicePixels="true">
  48. <ContentPresenter />
  49. </Border>
  50. <ControlTemplate.Triggers>
  51. <MultiTrigger>
  52. <MultiTrigger.Conditions>
  53. <Condition Property="IsOverModular"
  54. Value="True" />
  55. </MultiTrigger.Conditions>
  56. <Setter TargetName="Border"
  57. Property="Background"
  58. Value="{StaticResource Item.MouseOver.Background}" />
  59. <Setter TargetName="Border"
  60. Property="BorderBrush"
  61. Value="{StaticResource Item.MouseOver.Border}" />
  62. </MultiTrigger>
  63. </ControlTemplate.Triggers>
  64. </ControlTemplate>
  65. </Setter.Value>
  66. </Setter>
  67. <Style.Triggers />
  68. </Style>
  69. <Style x:Key="MoreListBoxItemStyle"
  70. TargetType="{x:Type customControl:ListItemQuickTool}">
  71. <Setter Property="SnapsToDevicePixels"
  72. Value="True" />
  73. <Setter Property="Template">
  74. <Setter.Value>
  75. <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
  76. <Border x:Name="Border" Margin="0,0,0,30"
  77. Background="LightGray"
  78. SnapsToDevicePixels="False">
  79. <ContentPresenter />
  80. </Border>
  81. <ControlTemplate.Triggers>
  82. <MultiTrigger>
  83. <MultiTrigger.Conditions>
  84. <Condition Property="IsSelected"
  85. Value="true" />
  86. </MultiTrigger.Conditions>
  87. <MultiTrigger.Setters>
  88. <Setter TargetName="Border"
  89. Property="Background"
  90. Value="LightGoldenrodYellow" />
  91. </MultiTrigger.Setters>
  92. </MultiTrigger>
  93. </ControlTemplate.Triggers>
  94. </ControlTemplate>
  95. </Setter.Value>
  96. </Setter>
  97. </Style>
  98. </ResourceDictionary>