PropertyGrid.xaml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:hc="clr-namespace:HandyControl.Controls"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:system="clr-namespace:System;assembly=mscorlib"
  5. xmlns:tools="clr-namespace:HandyControl.Tools">
  6. <Style BasedOn="{StaticResource PropertyGridBaseStyle}" TargetType="hc:PropertyGrid"/>
  7. <Style x:Key="ComboBoxItemCapsuleBaseStyle" BasedOn="{x:Null}" TargetType="ComboBoxItem">
  8. <Setter Property="MinWidth" Value="40"/>
  9. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  10. <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
  11. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  12. <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
  13. <Setter Property="BorderThickness" Value="1"/>
  14. <Setter Property="VerticalAlignment" Value="Center"/>
  15. <Setter Property="hc:BorderElement.CornerRadius" Value="0"/>
  16. <Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
  17. <Setter Property="Padding" Value="10,0"/>
  18. <Setter Property="Margin" Value="-1,0,0,0"/>
  19. <Setter Property="Template">
  20. <Setter.Value>
  21. <ControlTemplate TargetType="ComboBoxItem">
  22. <Border x:Name="BorderRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
  23. <ContentPresenter x:Name="contentPresenter" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" TextElement.Foreground="{TemplateBinding Foreground}" Focusable="False" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
  24. </Border>
  25. </ControlTemplate>
  26. </Setter.Value>
  27. </Setter>
  28. <Style.Triggers>
  29. <Trigger Property="IsSelected" Value="True">
  30. <Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}"/>
  31. </Trigger>
  32. <Trigger Property="IsMouseOver" Value="True">
  33. <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
  34. <Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}"/>
  35. </Trigger>
  36. <Trigger Property="IsSelected" Value="true">
  37. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
  38. <Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
  39. <Setter Property="TextElement.Foreground" Value="{DynamicResource TextIconBrush}"/>
  40. </Trigger>
  41. </Style.Triggers>
  42. </Style>
  43. <Style x:Key="ComboBoxItemCapsuleDefault" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem"/>
  44. <Style x:Key="ComboBoxItemCapsuleHorizontalFirst" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
  45. <Setter Property="hc:BorderElement.CornerRadius" Value="4,0,0,4"/>
  46. <Setter Property="Margin" Value="0"/>
  47. </Style>
  48. <Style x:Key="ComboBoxItemCapsuleHorizontalLast" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
  49. <Setter Property="hc:BorderElement.CornerRadius" Value="0,4,4,0"/>
  50. </Style>
  51. <Style x:Key="ComboBoxItemCapsuleSingle" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
  52. <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
  53. </Style>
  54. <Style x:Key="ComboBoxItemCapsuleVerticalFirst" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
  55. <Setter Property="hc:BorderElement.CornerRadius" Value="4,4,0,0"/>
  56. <Setter Property="Margin" Value="0"/>
  57. </Style>
  58. <Style x:Key="ComboBoxItemCapsuleVerticalLast" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
  59. <Setter Property="hc:BorderElement.CornerRadius" Value="0,0,4,4"/>
  60. </Style>
  61. <tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector"/>
  62. <Style x:Key="ComboBoxCapsule" BasedOn="{x:Null}" TargetType="ComboBox">
  63. <Setter Property="ItemContainerStyleSelector" Value="{StaticResource ComboBoxItemCapsuleStyleSelector}"/>
  64. <Setter Property="VerticalAlignment" Value="Top"/>
  65. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  66. <Setter Property="Focusable" Value="False"/>
  67. <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}"/>
  68. <Setter Property="Template">
  69. <Setter.Value>
  70. <ControlTemplate TargetType="ComboBox">
  71. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  72. </ControlTemplate>
  73. </Setter.Value>
  74. </Setter>
  75. </Style>
  76. <hc:HorizontalAlignmentPathTemplateSelector x:Key="HorizontalAlignmentPathTemplateSelector"/>
  77. <hc:VerticalAlignmentPathTemplateSelector x:Key="VerticalAlignmentPathTemplateSelector"/>
  78. </ResourceDictionary>