Styles.xaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <Styles
  2. xmlns="https://github.com/avaloniaui"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
  5. xmlns:sys="clr-namespace:System;assembly=netstandard">
  6. <Design.PreviewWith>
  7. <Border Padding="20" Height="2000">
  8. <StackPanel Spacing="5">
  9. <TextBlock Text="Code Font Family" />
  10. <Grid RowDefinitions="*,Auto">
  11. <Menu Grid.Row="1" Width="100">
  12. <MenuItem Header="File">
  13. <MenuItem Header="Test 1" />
  14. <MenuItem Header="Test 2" />
  15. <MenuItem Header="Test 3">
  16. <MenuItem.Icon>
  17. <CheckBox Margin="0" IsChecked="{Binding Checkbox, Mode=TwoWay}" />
  18. </MenuItem.Icon>
  19. </MenuItem>
  20. </MenuItem>
  21. </Menu>
  22. <StackPanel Orientation="Horizontal">
  23. <ToggleButton
  24. Name="btnAdd"
  25. HorizontalAlignment="Right"
  26. Height="28"
  27. Content="Addy" />
  28. <Button
  29. Name="btnRem"
  30. HorizontalAlignment="Right"
  31. Content="Add" />
  32. <TextBox Width="100" VerticalAlignment="Center" Text="Rrrrr" Watermark="Hello"
  33. UseFloatingWatermark="True" />
  34. <CheckBox>Test Check</CheckBox>
  35. </StackPanel>
  36. </Grid>
  37. <ui:NumberBox Value="1" />
  38. </StackPanel>
  39. </Border>
  40. </Design.PreviewWith>
  41. <Style Selector="Border.small">
  42. <Setter Property="Width" Value="100" />
  43. </Style>
  44. <Style Selector="Border.normal">
  45. <Setter Property="Width" Value="130" />
  46. </Style>
  47. <Style Selector="Border.large">
  48. <Setter Property="Width" Value="160" />
  49. </Style>
  50. <Style Selector="Border.huge">
  51. <Setter Property="Width" Value="200" />
  52. </Style>
  53. <Style Selector="Image.small">
  54. <Setter Property="Width" Value="50" />
  55. </Style>
  56. <Style Selector="Image.normal">
  57. <Setter Property="Width" Value="80" />
  58. </Style>
  59. <Style Selector="Image.large">
  60. <Setter Property="Width" Value="100" />
  61. </Style>
  62. <Style Selector="Image.huge">
  63. <Setter Property="Width" Value="120" />
  64. </Style>
  65. <Style Selector="RadioButton">
  66. <Setter Property="VerticalContentAlignment" Value="Center" />
  67. </Style>
  68. <Style Selector="#TitleBarHost > Image">
  69. <Setter Property="Margin" Value="10" />
  70. </Style>
  71. <Style Selector="#TitleBarHost > Label">
  72. <Setter Property="Margin" Value="5" />
  73. <Setter Property="FontSize" Value="14" />
  74. </Style>
  75. <Style Selector="Button.SystemCaption">
  76. <Setter Property="MinWidth" Value="10" />
  77. </Style>
  78. <Style Selector="DataGridColumnHeader">
  79. <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
  80. <Setter Property="HorizontalContentAlignment" Value="Center" />
  81. <Setter Property="BorderThickness" Value="1" />
  82. <Setter Property="VerticalContentAlignment" Value="Center" />
  83. <Setter Property="Background" Value="{DynamicResource ThemeControlBorderColor}" />
  84. <Setter Property="SeparatorBrush" Value="{DynamicResource ThemeControlBorderColor}" />
  85. <Setter Property="Padding" Value="5" />
  86. <Setter Property="Background" Value="{DynamicResource ThemeContentBackgroundColor}" />
  87. <Setter Property="Template">
  88. <ControlTemplate>
  89. <Grid Background="{TemplateBinding Background}" ColumnDefinitions="*,Auto">
  90. <Grid
  91. Margin="{TemplateBinding Padding}"
  92. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  93. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  94. ColumnDefinitions="*,Auto">
  95. <ContentPresenter Content="{TemplateBinding Content}" />
  96. <Path
  97. Name="SortIcon"
  98. Grid.Column="1"
  99. Width="8"
  100. Margin="4,0,0,0"
  101. HorizontalAlignment="Left"
  102. VerticalAlignment="Center"
  103. Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z "
  104. Fill="{TemplateBinding Foreground}"
  105. Stretch="Uniform" />
  106. </Grid>
  107. <Rectangle
  108. Name="VerticalSeparator"
  109. Grid.Column="1"
  110. Width="1"
  111. VerticalAlignment="Stretch"
  112. Fill="{TemplateBinding SeparatorBrush}"
  113. IsVisible="{TemplateBinding AreSeparatorsVisible}" />
  114. </Grid>
  115. </ControlTemplate>
  116. </Setter>
  117. </Style>
  118. <Style Selector="DataGrid">
  119. <Setter Property="RowBackground" Value="{DynamicResource ThemeAccentBrush4}" />
  120. <Setter Property="AlternatingRowBackground" Value="#00FFFFFF" />
  121. <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
  122. <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowColor}" />
  123. <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
  124. </Style>
  125. <Style Selector="DataGridRow:selected:focus /template/ Rectangle#BackgroundRectangle">
  126. <Setter Property="Fill" Value="{DynamicResource SystemAccentColor}" />
  127. <Setter Property="Opacity" Value="{DynamicResource DataGridRowSelectedBackgroundOpacity}" />
  128. </Style>
  129. <Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
  130. <Setter Property="Fill" Value="{DynamicResource SystemListLowColor}" />
  131. </Style>
  132. <Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
  133. <Setter Property="Fill" Value="{DynamicResource SystemAccentColor}" />
  134. <Setter Property="Opacity" Value="{DynamicResource DataGridRowSelectedUnfocusedBackgroundOpacity}" />
  135. </Style>
  136. <Style Selector="DataGridRow:selected:pointerover /template/ Rectangle#BackgroundRectangle">
  137. <Setter Property="Fill" Value="{DynamicResource SystemAccentColor}" />
  138. <Setter Property="Opacity" Value="{DynamicResource DataGridRowSelectedHoveredUnfocusedBackgroundOpacity}" />
  139. </Style>
  140. <Style Selector="DataGridRow:selected:pointerover:focus /template/ Rectangle#BackgroundRectangle">
  141. <Setter Property="Fill" Value="{DynamicResource SystemAccentColor}" />
  142. <Setter Property="Opacity" Value="{DynamicResource DataGridRowSelectedHoveredBackgroundOpacity}" />
  143. </Style>
  144. <Style Selector="DataGridCell">
  145. <Setter Property="HorizontalAlignment" Value="Center" />
  146. <Setter Property="HorizontalContentAlignment" Value="Center" />
  147. </Style>
  148. <Style Selector="DataGridCell.Left">
  149. <Setter Property="HorizontalAlignment" Value="Left" />
  150. </Style>
  151. <Style Selector="CheckBox">
  152. <Setter Property="BorderThickness" Value="1" />
  153. </Style>
  154. <Style Selector="MenuItem">
  155. <Setter Property="Height" Value="{DynamicResource MenuItemHeight}" />
  156. <Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" />
  157. </Style>
  158. <Style Selector="MenuItem:selected /template/ Border#root">
  159. <Setter Property="Background" Value="{DynamicResource ThemeControlBorderColor}" />
  160. <Setter Property="BorderBrush" Value="{DynamicResource ThemeControlBorderColor}" />
  161. </Style>
  162. <Style Selector="TabItem &gt; ScrollViewer">
  163. <Setter Property="Background" Value="{DynamicResource ThemeBackgroundColor}" />
  164. <Setter Property="Margin" Value="0,-5,0,0" />
  165. </Style>
  166. <Style Selector="TabItem &gt; ScrollViewer &gt; Border">
  167. <Setter Property="BorderThickness" Value="0,1,0,0" />
  168. <Setter Property="Background" Value="{DynamicResource ThemeBackgroundColor}" />
  169. <Setter Property="BorderBrush" Value="{DynamicResource HighlightBrush}" />
  170. </Style>
  171. <Style Selector="Button">
  172. <Setter Property="MinWidth" Value="80" />
  173. </Style>
  174. <Style Selector="ToggleButton">
  175. <Setter Property="Padding" Value="0,-5,0,0" />
  176. </Style>
  177. <Style Selector="TabItem">
  178. <Setter Property="FontSize" Value="14" />
  179. <Setter Property="BorderThickness" Value="0,0,1,0" />
  180. <Setter Property="BorderBrush" Value="{DynamicResource ThemeButtonForegroundColor}" />
  181. <Setter Property="Background" Value="{DynamicResource HighlightColor}" />
  182. </Style>
  183. <Style Selector="TabItem:pointerover">
  184. <Setter Property="Foreground" Value="{DynamicResource ThemeButtonForegroundColor}" />
  185. </Style>
  186. <Style Selector="TabItem:selected">
  187. <Setter Property="Background" Value="{DynamicResource HighlightColor}" />
  188. <Setter Property="Foreground" Value="{DynamicResource ThemeBackgroundColor}" />
  189. </Style>
  190. <Style Selector="TextBlock">
  191. <Setter Property="Margin" Value="{DynamicResource TextMargin}" />
  192. <Setter Property="FontSize" Value="{DynamicResource FontSize}" />
  193. <Setter Property="VerticalAlignment" Value="Center" />
  194. </Style>
  195. <Style Selector="Separator">
  196. <Setter Property="Background" Value="{DynamicResource ThemeControlBorderColor}" />
  197. <Setter Property="Foreground" Value="{DynamicResource ThemeControlBorderColor}" />
  198. <Setter Property="MinHeight" Value="1" />
  199. </Style>
  200. <Style Selector=":is(Button).DateTimeFlyoutButtonStyle">
  201. <Setter Property="Background" Value="{DynamicResource HighlightColor}" />
  202. <Setter Property="Foreground" Value="{DynamicResource ThemeBackgroundColor}" />
  203. </Style>
  204. <Style Selector="DatePickerPresenter">
  205. <Setter Property="BorderThickness" Value="1" />
  206. <Setter Property="BorderBrush" Value="{DynamicResource ThemeButtonForegroundColor}" />
  207. </Style>
  208. <Style Selector="DataGridCell">
  209. <Setter Property="FontSize" Value="14" />
  210. </Style>
  211. <Style Selector="CheckBox TextBlock">
  212. <Setter Property="Margin" Value="0,5,0,0" />
  213. </Style>
  214. <Style Selector="ContextMenu">
  215. <Setter Property="BorderBrush" Value="{DynamicResource MenuFlyoutPresenterBorderBrush}" />
  216. <Setter Property="BorderThickness" Value="{DynamicResource MenuFlyoutPresenterBorderThemeThickness}" />
  217. </Style>
  218. <Style Selector="TextBox.NumberBoxTextBoxStyle">
  219. <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundColor}" />
  220. </Style>
  221. <Styles.Resources>
  222. <StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="ThemeAccentColorBrush" />
  223. <StaticResource x:Key="ListViewItemBackgroundPressed" ResourceKey="SystemAccentColorDark1" />
  224. <StaticResource x:Key="ListViewItemBackgroundPointerOver" ResourceKey="SystemAccentColorDark2" />
  225. <StaticResource x:Key="ListViewItemBackgroundSelectedPressed" ResourceKey="ThemeAccentColorBrush" />
  226. <StaticResource x:Key="ListViewItemBackgroundSelectedPointerOver" ResourceKey="SystemAccentColorDark2" />
  227. <SolidColorBrush x:Key="DataGridGridLinesBrush"
  228. Color="{DynamicResource SystemBaseMediumLowColor}"
  229. Opacity="0.4" />
  230. <SolidColorBrush x:Key="DataGridSelectionBackgroundBrush" Color="{DynamicResource DataGridSelectionColor}" />
  231. <SolidColorBrush x:Key="MenuFlyoutPresenterBorderBrush"
  232. Color="{DynamicResource MenuFlyoutPresenterBorderColor}" />
  233. <SolidColorBrush x:Key="ThemeAccentColorBrush" Color="{DynamicResource SystemAccentColor}" />
  234. <SolidColorBrush x:Key="ListBoxBackground" Color="{DynamicResource ThemeContentBackgroundColor}" />
  235. <SolidColorBrush x:Key="ThemeForegroundBrush" Color="{DynamicResource ThemeForegroundColor}" />
  236. <SolidColorBrush x:Key="ThemeAccentBrush4" Color="{DynamicResource ThemeAccentColor4}" />
  237. <SolidColorBrush x:Key="SplitButtonBackgroundChecked" Color="#00E81123" />
  238. <SolidColorBrush x:Key="SplitButtonBackgroundCheckedPointerOver" Color="#00E81123" />
  239. <SolidColorBrush x:Key="SplitButtonBackgroundCheckedPressed" Color="#00E81123" />
  240. <SolidColorBrush x:Key="SplitButtonBackgroundCheckedDisabled" Color="#00E81123" />
  241. <Thickness x:Key="PageMargin">40 0 40 0</Thickness>
  242. <Thickness x:Key="Margin">0 5 0 5</Thickness>
  243. <Thickness x:Key="TextMargin">0 4 0 0</Thickness>
  244. <Thickness x:Key="MenuItemPadding">5 0 5 0</Thickness>
  245. <Color x:Key="MenuFlyoutPresenterBorderColor">#00000000</Color>
  246. <Color x:Key="SystemAccentColor">#FF00C3E3</Color>
  247. <Color x:Key="SystemAccentColorDark1">#FF00C3E3</Color>
  248. <Color x:Key="SystemAccentColorDark2">#FF00C3E3</Color>
  249. <Color x:Key="SystemAccentColorDark3">#FF00C3E3</Color>
  250. <Color x:Key="SystemAccentColorLight1">#FF00C3E3</Color>
  251. <Color x:Key="SystemAccentColorLight2">#FF00C3E3</Color>
  252. <Color x:Key="SystemAccentColorLight3">#FF00C3E3</Color>
  253. <Color x:Key="DataGridSelectionColor">#FF00FABB</Color>
  254. <Color x:Key="ThemeContentBackgroundColor">#FF2D2D2D</Color>
  255. <Color x:Key="ThemeControlBorderColor">#FF505050</Color>
  256. <sys:Double x:Key="ScrollBarThickness">15</sys:Double>
  257. <sys:Double x:Key="FontSizeSmall">8</sys:Double>
  258. <sys:Double x:Key="FontSizeNormal">10</sys:Double>
  259. <sys:Double x:Key="FontSize">12</sys:Double>
  260. <sys:Double x:Key="FontSizeLarge">15</sys:Double>
  261. <sys:Double x:Key="ControlContentThemeFontSize">13</sys:Double>
  262. <x:Double x:Key="MenuItemHeight">26</x:Double>
  263. <x:Double x:Key="TabItemMinHeight">28</x:Double>
  264. </Styles.Resources>
  265. </Styles>