You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
8.0 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:bpa="clr-namespace:BPA.UIControl">
  4. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Resources/Default.xaml" />
  6. </ResourceDictionary.MergedDictionaries>
  7. <!-- ListBoxItem -->
  8. <Style x:Key="RubyerListBoxItem" TargetType="{x:Type ListBoxItem}">
  9. <Setter Property="Background" Value="Transparent" />
  10. <Setter Property="BorderBrush" Value="Transparent" />
  11. <Setter Property="BorderThickness" Value="0" />
  12. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
  13. <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=ListBox}}" />
  14. <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=ListBox}}" />
  15. <Setter Property="Padding" Value="{Binding Path=(bpa:ItemsControlHelper.ItemPadding), RelativeSource={RelativeSource AncestorType=ListBox}}" />
  16. <Setter Property="Margin" Value="{Binding Path=(bpa:ItemsControlHelper.ItemMargin), RelativeSource={RelativeSource AncestorType=ListBox}}" />
  17. <Setter Property="SnapsToDevicePixels" Value="True" />
  18. <Setter Property="Template">
  19. <Setter.Value>
  20. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  21. <Grid x:Name="root">
  22. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=ItemsControl}}"
  23. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=ItemsControl}}"
  24. IsActive="{TemplateBinding IsSelected}"
  25. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=ItemsControl}}" />
  26. <bpa:Transition HorizontalAlignment="Left"
  27. IsShow="{TemplateBinding IsSelected}"
  28. Type="ZoomY"
  29. Visibility="{Binding Path=(bpa:ListBoxHelper.IsShowLittleBar), RelativeSource={RelativeSource AncestorType=ListBox}, Converter={StaticResource BooleanToVisibleConverter}}">
  30. <Rectangle Width="3"
  31. Height="{Binding ActualHeight, ElementName=content}"
  32. Fill="{Binding Path=(bpa:ControlHelper.SelectedBrush), RelativeSource={RelativeSource AncestorType=ItemsControl}}" />
  33. </bpa:Transition>
  34. <Border x:Name="Bd"
  35. Background="{TemplateBinding Background}"
  36. BorderBrush="{TemplateBinding BorderBrush}"
  37. BorderThickness="{TemplateBinding BorderThickness}"
  38. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  39. <ContentPresenter x:Name="content"
  40. Margin="{TemplateBinding Padding}"
  41. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  42. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  43. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  44. </Border>
  45. </Grid>
  46. <ControlTemplate.Triggers>
  47. <Trigger Property="IsEnabled" Value="False">
  48. <Setter TargetName="root" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  49. </Trigger>
  50. <Trigger Property="IsSelected" Value="True">
  51. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource AncestorType=ItemsControl}}" />
  52. </Trigger>
  53. </ControlTemplate.Triggers>
  54. </ControlTemplate>
  55. </Setter.Value>
  56. </Setter>
  57. </Style>
  58. <!-- ListBox -->
  59. <Style x:Key="RubyerListBox" TargetType="{x:Type ListBox}">
  60. <Setter Property="Background" Value="Transparent" />
  61. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  62. <Setter Property="BorderThickness" Value="0" />
  63. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  64. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  65. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
  66. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  67. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  68. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  69. <Setter Property="VerticalContentAlignment" Value="Center" />
  70. <Setter Property="SnapsToDevicePixels" Value="True" />
  71. <Setter Property="ItemContainerStyle" Value="{StaticResource RubyerListBoxItem}" />
  72. <Setter Property="bpa:ControlHelper.SelectedBrush" Value="{DynamicResource Primary}" />
  73. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Mask}" />
  74. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource DefaultForeground}" />
  75. <Setter Property="bpa:ControlHelper.CornerRadius" Value="0" />
  76. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="0.6" />
  77. <Setter Property="bpa:ItemsControlHelper.ItemMargin" Value="0" />
  78. <Setter Property="bpa:ItemsControlHelper.ItemPadding" Value="5" />
  79. <Setter Property="Template">
  80. <Setter.Value>
  81. <ControlTemplate TargetType="{x:Type ListBox}">
  82. <Border x:Name="Bd"
  83. Padding="0"
  84. Background="{TemplateBinding Background}"
  85. BorderBrush="{TemplateBinding BorderBrush}"
  86. BorderThickness="{TemplateBinding BorderThickness}"
  87. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  88. <ScrollViewer Padding="{TemplateBinding Padding}"
  89. Focusable="False"
  90. HorizontalScrollBarVisibility="{Binding Path=(ScrollViewer.HorizontalScrollBarVisibility), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  91. VerticalScrollBarVisibility="{Binding Path=(ScrollViewer.VerticalScrollBarVisibility), RelativeSource={RelativeSource Mode=TemplatedParent}}">
  92. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  93. </ScrollViewer>
  94. </Border>
  95. <ControlTemplate.Triggers>
  96. <Trigger Property="IsEnabled" Value="False">
  97. <Setter TargetName="Bd" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  98. </Trigger>
  99. <MultiTrigger>
  100. <MultiTrigger.Conditions>
  101. <Condition Property="IsGrouping" Value="true" />
  102. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False" />
  103. </MultiTrigger.Conditions>
  104. <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
  105. </MultiTrigger>
  106. </ControlTemplate.Triggers>
  107. </ControlTemplate>
  108. </Setter.Value>
  109. </Setter>
  110. </Style>
  111. </ResourceDictionary>