DropDownButton.axaml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <ResourceDictionary xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:content="clr-namespace:SukiUI.Content"
  4. xmlns:suki="https://github.com/kikipoulet/SukiUI">
  5. <ControlTheme x:Key="SukiDropDownButtonStyle" TargetType="DropDownButton">
  6. <Setter Property="BorderThickness" Value="1.2" />
  7. <Setter Property="BorderBrush" Value="{DynamicResource SukiMediumBorderBrush}" />
  8. <Setter Property="CornerRadius" Value="{DynamicResource SmallCornerRadius}" />
  9. <Setter Property="Background" Value="{DynamicResource SukiBackground}" />
  10. <Setter Property="VerticalContentAlignment" Value="Center" />
  11. <Setter Property="FontSize" Value="15" />
  12. <Setter Property="Padding" Value="20,8" />
  13. <Setter Property="FontWeight" Value="{DynamicResource DefaultDemiBold}" />
  14. <Setter Property="Template">
  15. <Setter.Value>
  16. <ControlTemplate>
  17. <suki:GlassCard Name="RootBorder" Classes="Discrete"
  18. Padding="0"
  19. ClipToBounds="True"
  20. CornerRadius="{TemplateBinding CornerRadius}">
  21. <suki:GlassCard.Transitions>
  22. <Transitions>
  23. <BrushTransition Property="BorderBrush" Duration="0:0:0.25" />
  24. </Transitions>
  25. </suki:GlassCard.Transitions>
  26. <Grid Name="InnerGrid">
  27. <Grid.ColumnDefinitions>
  28. <ColumnDefinition Width="*" />
  29. <ColumnDefinition Width="Auto" />
  30. </Grid.ColumnDefinitions>
  31. <ContentPresenter Name="PART_ContentPresenter"
  32. Grid.Column="0"
  33. Padding="{TemplateBinding Padding}"
  34. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  35. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  36. Content="{TemplateBinding Content}"
  37. ContentTemplate="{TemplateBinding ContentTemplate}"
  38. FontFamily="{TemplateBinding FontFamily}"
  39. FontWeight="{TemplateBinding FontWeight}"
  40. RecognizesAccessKey="True">
  41. <ContentPresenter.Transitions>
  42. <Transitions>
  43. <BrushTransition Property="Foreground" Duration="0:0:0.25" />
  44. <BrushTransition Property="BorderBrush" Duration="0:0:0.25" />
  45. </Transitions>
  46. </ContentPresenter.Transitions>
  47. </ContentPresenter>
  48. <PathIcon Name="PART_Icon"
  49. Grid.Column="1"
  50. Width="12"
  51. Height="12"
  52. Margin="0,0,10,0"
  53. HorizontalAlignment="Right"
  54. VerticalAlignment="Center"
  55. Data="{x:Static content:Icons.ChevronDown}"
  56. Foreground="{DynamicResource SukiText}"
  57. IsHitTestVisible="False"
  58. UseLayoutRounding="False">
  59. <PathIcon.Transitions>
  60. <Transitions>
  61. <BrushTransition Property="Foreground" Duration="0:0:0.25" />
  62. </Transitions>
  63. </PathIcon.Transitions>
  64. </PathIcon>
  65. </Grid>
  66. </suki:GlassCard>
  67. </ControlTemplate>
  68. </Setter.Value>
  69. </Setter>
  70. <Style Selector="^:pointerover">
  71. <Style Selector="^ /template/ TextBlock">
  72. <Setter Property="Foreground" Value="{DynamicResource SukiPrimaryColor}" />
  73. </Style>
  74. <Style Selector="^ /template/ ContentPresenter">
  75. <Setter Property="Foreground" Value="{DynamicResource SukiPrimaryColor}" />
  76. </Style>
  77. <Style Selector="^ /template/ Border">
  78. <Setter Property="BorderBrush" Value="{DynamicResource SukiPrimaryColor}" />
  79. </Style>
  80. <Style Selector="^ /template/ PathIcon#PART_Icon">
  81. <Setter Property="Foreground" Value="{DynamicResource SukiPrimaryColor}" />
  82. </Style>
  83. </Style>
  84. <Style Selector="^:pressed">
  85. <Style Selector="^ /template/ TextBlock">
  86. <Setter Property="Foreground" Value="{DynamicResource SukiPrimaryColor}" />
  87. </Style>
  88. <Style Selector="^ /template/ Border">
  89. <Setter Property="BorderBrush" Value="{DynamicResource SukiPrimaryColor}" />
  90. <Setter Property="RenderTransform">
  91. <Setter.Value>
  92. <ScaleTransform ScaleX="0.97" ScaleY="0.97" />
  93. </Setter.Value>
  94. </Setter>
  95. </Style>
  96. <Style Selector="^ /template/ ContentPresenter">
  97. <Setter Property="Foreground" Value="{DynamicResource SukiPrimaryColor}" />
  98. </Style>
  99. </Style>
  100. <Style Selector="^:disabled">
  101. <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
  102. </Style>
  103. </ControlTheme>
  104. <ControlTheme x:Key="{x:Type DropDownButton}"
  105. BasedOn="{StaticResource SukiDropDownButtonStyle}"
  106. TargetType="DropDownButton" />
  107. </ResourceDictionary>