RadioButtonStyles.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <Styles 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. <Design.PreviewWith>
  6. <Border Padding="20" Background="White">
  7. <StackPanel Orientation="Horizontal">
  8. <RadioButton Margin="5" Classes="Chips">
  9. <TextBlock>test 2</TextBlock>
  10. </RadioButton>
  11. <RadioButton Margin="5" Classes="GigaChips">
  12. <TextBlock>test 2</TextBlock>
  13. </RadioButton>
  14. <RadioButton Margin="5" Classes="GigaChips">
  15. <TextBlock>test 3</TextBlock>
  16. </RadioButton>
  17. </StackPanel>
  18. </Border>
  19. </Design.PreviewWith>
  20. <Style Selector="RadioButton AccessText">
  21. <Setter Property="Foreground" Value="{DynamicResource SukiText}" />
  22. </Style>
  23. <Style Selector="RadioButton.Chips">
  24. <Setter Property="Background" Value="{DynamicResource SukiPrimaryColor0}" />
  25. <Setter Property="BorderBrush" Value="{DynamicResource SukiBorderBrush}" />
  26. <Setter Property="BorderThickness" Value="1" />
  27. <Setter Property="CornerRadius" Value="50" />
  28. <Setter Property="Template">
  29. <ControlTemplate>
  30. <Grid>
  31. <Border
  32. Background="{TemplateBinding Background}"
  33. BorderBrush="{TemplateBinding BorderBrush}"
  34. BorderThickness="{TemplateBinding BorderThickness}"
  35. CornerRadius="{TemplateBinding CornerRadius}"
  36. Margin="0,0,0,0"
  37. Padding="10">
  38. <Border.Transitions>
  39. <Transitions>
  40. <BrushTransition Property="Background" Duration="0:0:0.15"></BrushTransition>
  41. <ThicknessTransition Duration="0:0:0.2" Property="Margin" />
  42. </Transitions>
  43. </Border.Transitions>
  44. <StackPanel
  45. HorizontalAlignment="Center"
  46. Orientation="Horizontal"
  47. VerticalAlignment="Center">
  48. <ContentPresenter
  49. Content="{TemplateBinding Content}"
  50. ContentTemplate="{TemplateBinding ContentTemplate}"
  51. HorizontalAlignment="Center"
  52. HorizontalContentAlignment="Center"
  53. Margin="15,0,15,0"
  54. Name="PART_ContentPresenter"
  55. RecognizesAccessKey="True"
  56. VerticalAlignment="Center" />
  57. </StackPanel>
  58. </Border>
  59. </Grid>
  60. </ControlTemplate>
  61. </Setter>
  62. </Style>
  63. <Style Selector="RadioButton.Chips TextBlock">
  64. <Setter Property="Foreground" Value="{DynamicResource SukiLowText}" />
  65. </Style>
  66. <Style Selector="RadioButton.Chips:checked TextBlock">
  67. <Setter Property="Foreground" Value="White" />
  68. <Setter Property="FontWeight" Value="Bold"></Setter>
  69. </Style>
  70. <Style Selector="RadioButton.Chips:checked AccessText">
  71. <Setter Property="Foreground" Value="White" />
  72. <Setter Property="FontWeight" Value="DemiBold"></Setter>
  73. </Style>
  74. <Style Selector="RadioButton.Chips:checked Border">
  75. <Setter Property="BorderBrush" Value="{DynamicResource SukiPrimaryColor}" />
  76. <Setter Property="BorderThickness" Value="0" />
  77. <Setter Property="Background" Value="{DynamicResource SukiPrimaryColor}" />
  78. </Style>
  79. <Style Selector="RadioButton.GigaChips">
  80. <Setter Property="Background" Value="Transparent" />
  81. <Setter Property="BorderBrush" Value="{DynamicResource SukiControlBorderBrush}" />
  82. <Setter Property="BorderThickness" Value="1" />
  83. <Setter Property="CornerRadius" Value="{DynamicResource MediumCornerRadius}" />
  84. <Setter Property="Margin" Value="0" />
  85. <Setter Property="FontSize" Value="14" />
  86. <Setter Property="Template">
  87. <ControlTemplate>
  88. <Panel>
  89. <suki:GlassCard Name="BigBorder" IsInteractive="True"
  90. Margin="4"
  91. Padding="15,15,30,15"
  92. ClipToBounds="True"
  93. CornerRadius="{TemplateBinding CornerRadius}">
  94. <ContentPresenter Name="PART_ContentPresenter"
  95. Content="{TemplateBinding Content}"
  96. ContentTemplate="{TemplateBinding ContentTemplate}"
  97. FontSize="{TemplateBinding FontSize}"
  98. RecognizesAccessKey="True" />
  99. </suki:GlassCard>
  100. <PathIcon Width="20"
  101. Height="20"
  102. Margin="12"
  103. HorizontalAlignment="Right"
  104. VerticalAlignment="Top"
  105. Data="{x:Static content:Icons.CircleCheck}"
  106. Foreground="{DynamicResource SukiPrimaryColor}">
  107. <PathIcon.Transitions>
  108. <Transitions>
  109. <DoubleTransition Property="Opacity" Duration="00:00:0.2" />
  110. </Transitions>
  111. </PathIcon.Transitions>
  112. </PathIcon>
  113. <Border Name="SelectedBorder"
  114. Margin="3"
  115. BorderBrush="{DynamicResource SukiPrimaryColor}"
  116. Background="{DynamicResource SukiPrimaryColor5}"
  117. BorderThickness="1.5"
  118. CornerRadius="{TemplateBinding CornerRadius}"
  119. Opacity="0">
  120. <Border.Transitions>
  121. <Transitions>
  122. <DoubleTransition Property="Opacity" Duration="0:0:0.2" />
  123. </Transitions>
  124. </Border.Transitions>
  125. </Border>
  126. </Panel>
  127. </ControlTemplate>
  128. </Setter>
  129. </Style>
  130. <Style Selector="RadioButton.GigaChips:checked Border#SelectedBorder">
  131. <Setter Property="Opacity" Value="1" />
  132. </Style>
  133. <Style Selector="RadioButton.GigaChips PathIcon">
  134. <Setter Property="Opacity" Value="0" />
  135. </Style>
  136. <Style Selector="RadioButton.GigaChips:checked PathIcon">
  137. <Setter Property="Opacity" Value="1" />
  138. </Style>
  139. <Style Selector="RadioButton.MenuItemMobile:checked /template/ Border">
  140. <Setter Property="CornerRadius" Value="0,50,50,0" />
  141. <Setter Property="Background">
  142. <Setter.Value>
  143. <LinearGradientBrush StartPoint="80%,-50%" EndPoint="0%,100%">
  144. <GradientStop Offset="0.1" Color="#637ff0" />
  145. <GradientStop Offset="0.6" Color="#4969ed" />
  146. </LinearGradientBrush>
  147. </Setter.Value>
  148. </Setter>
  149. </Style>
  150. <Style Selector="RadioButton.MenuItem">
  151. <Setter Property="Height" Value="50" />
  152. <Setter Property="Margin" Value="-30,0,5,0" />
  153. <Setter Property="Background" Value="Transparent" />
  154. <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
  155. <Setter Property="BorderThickness" Value="0" />
  156. <Setter Property="Transitions">
  157. <Transitions>
  158. <ThicknessTransition Property="Margin" Duration="0:0:0.4" />
  159. </Transitions>
  160. </Setter>
  161. <Setter Property="Template">
  162. <ControlTemplate>
  163. <Panel>
  164. <Border Margin="0,0,0,0"
  165. Background="{TemplateBinding Background}"
  166. BorderBrush="{TemplateBinding BorderBrush}"
  167. BorderThickness="{TemplateBinding BorderThickness}"
  168. CornerRadius="{DynamicResource MediumCornerRadius}">
  169. <ContentPresenter Name="PART_ContentPresenter"
  170. Margin="0,2,-40,0"
  171. VerticalAlignment="Center"
  172. Content="{TemplateBinding Content}"
  173. ContentTemplate="{TemplateBinding ContentTemplate}"
  174. RecognizesAccessKey="True" />
  175. </Border>
  176. </Panel>
  177. </ControlTemplate>
  178. </Setter>
  179. </Style>
  180. <Style Selector="RadioButton">
  181. <Setter Property="Background" Value="Transparent" />
  182. <Setter Property="BorderBrush" Value="{DynamicResource SukiControlBorderBrush}" />
  183. <Setter Property="BorderThickness" Value="1.2" />
  184. <Setter Property="FontSize" Value="14" />
  185. <Setter Property="Template">
  186. <ControlTemplate>
  187. <Grid Background="{TemplateBinding Background}" ColumnDefinitions="Auto,*">
  188. <suki:GlassCard Width="20" Height="20" CornerRadius="50" Classes="Control"
  189. Classes.PrimaryOpaque="{TemplateBinding IsChecked}"
  190. />
  191. <Ellipse Height="8" Width="8" HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{TemplateBinding IsChecked}" Fill="White"/>
  192. <ContentPresenter Name="PART_ContentPresenter"
  193. Grid.Column="1"
  194. Margin="10,0,0,0"
  195. VerticalAlignment="Center"
  196. Content="{TemplateBinding Content}"
  197. ContentTemplate="{TemplateBinding ContentTemplate}"
  198. FontSize="{TemplateBinding FontSize}"
  199. RecognizesAccessKey="True" />
  200. </Grid>
  201. </ControlTemplate>
  202. </Setter>
  203. </Style>
  204. <Style Selector="RadioButton.MenuItem:checked">
  205. <Setter Property="TextBlock.FontWeight" Value="{DynamicResource DefaultDemiBold}" />
  206. <Setter Property="BorderThickness" Value="0,0,0,0" />
  207. <Setter Property="BorderBrush" Value="{DynamicResource SukiPrimaryColor}" />
  208. <Setter Property="Margin" Value="-30,5,5,5" />
  209. </Style>
  210. <Style Selector="RadioButton.MenuItem:pointerover /template/ Border">
  211. <Setter Property="Background" Value="{DynamicResource SukiLightBackground}" />
  212. </Style>
  213. <Style Selector="RadioButton.MenuItem:checked TextBlock">
  214. <Setter Property="FontWeight" Value="{DynamicResource DefaultDemiBold}" />
  215. <Setter Property="Foreground" Value="{DynamicResource SukiPrimaryColor}" />
  216. </Style>
  217. <Style Selector="RadioButton.MenuItem:checked /template/ Border">
  218. <Setter Property="Transitions">
  219. <Transitions>
  220. <BrushTransition Property="Background" Duration="0:0:0.15" />
  221. </Transitions>
  222. </Setter>
  223. <Setter Property="TextBlock.FontWeight" Value="{DynamicResource DefaultDemiBold}" />
  224. <Setter Property="TextBlock.Foreground" Value="{DynamicResource SukiPrimaryColor}" />
  225. <Setter Property="Background" Value="{DynamicResource SukiPrimaryColor10}" />
  226. <Setter Property="BorderBrush" Value="{DynamicResource SukiPrimaryColor}" />
  227. <Setter Property="BorderThickness" Value="0,0,0,0" />
  228. </Style>
  229. <Style Selector="RadioButton.MenuItem /template/ ContentPresenter#PART_ContentPresenter">
  230. <Setter Property="Transitions">
  231. <Transitions>
  232. <ThicknessTransition Property="Margin" Duration="0:0:0.25" />
  233. </Transitions>
  234. </Setter>
  235. </Style>
  236. <Style Selector="RadioButton.MenuItem:checked /template/ ContentPresenter#PART_ContentPresenter">
  237. <Setter Property="Transitions">
  238. <Transitions>
  239. <ThicknessTransition Property="Margin" Duration="0:0:0.25" />
  240. </Transitions>
  241. </Setter>
  242. <Setter Property="Margin" Value="-40,2,0,0" />
  243. </Style>
  244. <Style Selector="RadioButton.MenuItem:checked TextBlock">
  245. <!-- <Setter Property="Foreground" Value="{DynamicResource SukiPrimaryColor}" /> -->
  246. </Style>
  247. <Style Selector="RadioButton.MenuItem PathIcon">
  248. <!-- <Setter Property="Foreground" Value="{DynamicResource SukiPrimaryColor}" /> -->
  249. <Setter Property="Transitions">
  250. <Transitions>
  251. <DoubleTransition Property="Opacity" Duration="0:0:0.2" />
  252. </Transitions>
  253. </Setter>
  254. </Style>
  255. <Style Selector="RadioButton.MenuItem:checked ContentControl">
  256. <!-- <Setter Property="Foreground" Value="{DynamicResource SukiPrimaryColor}" /> -->
  257. <Setter Property="Transitions">
  258. <Transitions>
  259. <DoubleTransition Property="Opacity" Duration="0:0:0.2" />
  260. <ThicknessTransition Property="Margin" Duration="0:0:0.2" />
  261. </Transitions>
  262. </Setter>
  263. <!-- <Setter Property="Padding" Value="-52,0,0,0" /> -->
  264. <Setter Property="Opacity" Value="0" />
  265. </Style>
  266. <Style Selector="RadioButton:pointerover /template/ Ellipse#border">
  267. <Setter Property="Stroke" Value="{DynamicResource SukiBorderBrush}" />
  268. </Style>
  269. <Style Selector="RadioButton /template/ Ellipse#checkMark">
  270. <Setter Property="Fill" Value="{DynamicResource SukiCardBackground}" />
  271. <Setter Property="Width" Value="12" />
  272. <Setter Property="Height" Value="12" />
  273. <Setter Property="IsVisible" Value="True" />
  274. </Style>
  275. <Style Selector="RadioButton /template/ Ellipse#border">
  276. <Setter Property="Fill" Value="{DynamicResource SukiPrimaryColor}" />
  277. </Style>
  278. <Style Selector="RadioButton:checked /template/ Ellipse#checkMark">
  279. <Setter Property="Fill" Value="White" />
  280. <Setter Property="Width" Value="7" />
  281. <Setter Property="Height" Value="7" />
  282. </Style>
  283. <Style Selector="RadioButton /template/ Ellipse#indeterminateMark">
  284. <Setter Property="IsVisible" Value="False" />
  285. </Style>
  286. <Style Selector="RadioButton:indeterminate /template/ Ellipse#indeterminateMark">
  287. <Setter Property="IsVisible" Value="True" />
  288. </Style>
  289. <Style Selector="RadioButton:disabled /template/ Ellipse#border">
  290. <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
  291. </Style>
  292. </Styles>