CustomListItemStyle.xaml 4.9 KB

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