ThemePage.axaml 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <UserControl x:Class="ControlCatalog.Pages.ThemePage"
  2. xmlns="https://github.com/avaloniaui"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:pages="clr-namespace:ControlCatalog.Pages"
  7. d:DesignWidth="300"
  8. mc:Ignorable="d">
  9. <UserControl.Resources>
  10. <ResourceDictionary>
  11. <ResourceDictionary.ThemeDictionaries>
  12. <ResourceDictionary x:Key="Dark">
  13. <SolidColorBrush x:Key="DemoBackground">Black</SolidColorBrush>
  14. </ResourceDictionary>
  15. <ResourceDictionary x:Key="Light">
  16. <SolidColorBrush x:Key="DemoBackground">White</SolidColorBrush>
  17. </ResourceDictionary>
  18. <ResourceDictionary x:Key="{x:Static pages:ThemePage.Pink}">
  19. <SolidColorBrush x:Key="DemoBackground">#ffe5ea</SolidColorBrush>
  20. <SolidColorBrush x:Key="NormalBackgroundBrush" Color="#ffc0cb" />
  21. <SolidColorBrush x:Key="PointerOverBackgroundBrush" Color="#ffb3c0" />
  22. <SolidColorBrush x:Key="PressedBackgroundBrush" Color="#ff4d6c" />
  23. <SolidColorBrush x:Key="NormalBorderBrush" Color="#ff8096" />
  24. <SolidColorBrush x:Key="PointerOverBorderBrush" Color="#ff8096" />
  25. <SolidColorBrush x:Key="PressedBorderBrush" Color="#ff4d6c" />
  26. <!-- Override colors for fluent theme -->
  27. <StaticResource x:Key="ButtonBackground" ResourceKey="NormalBackgroundBrush" />
  28. <StaticResource x:Key="ButtonBackgroundPointerOver" ResourceKey="PointerOverBackgroundBrush" />
  29. <StaticResource x:Key="ButtonBackgroundPressed" ResourceKey="PressedBackgroundBrush" />
  30. <StaticResource x:Key="ButtonBorderBrush" ResourceKey="NormalBorderBrush" />
  31. <StaticResource x:Key="ButtonBorderBrushPointerOver" ResourceKey="PointerOverBorderBrush" />
  32. <StaticResource x:Key="ButtonBorderBrushPressed" ResourceKey="PressedBorderBrush" />
  33. <StaticResource x:Key="TextControlBackground" ResourceKey="NormalBackgroundBrush" />
  34. <StaticResource x:Key="TextControlBackgroundPointerOver" ResourceKey="PointerOverBackgroundBrush" />
  35. <StaticResource x:Key="TextControlBackgroundFocused" ResourceKey="PointerOverBackgroundBrush" />
  36. <StaticResource x:Key="TextControlBorderBrush" ResourceKey="NormalBorderBrush" />
  37. <StaticResource x:Key="TextControlBorderBrushPointerOver" ResourceKey="PointerOverBorderBrush" />
  38. <StaticResource x:Key="TextControlBorderBrushFocused" ResourceKey="PressedBorderBrush" />
  39. <StaticResource x:Key="ComboBoxBackground" ResourceKey="NormalBackgroundBrush" />
  40. <StaticResource x:Key="ComboBoxBackgroundPointerOver" ResourceKey="PointerOverBackgroundBrush" />
  41. <StaticResource x:Key="ComboBoxBackgroundPressed" ResourceKey="PressedBackgroundBrush" />
  42. <StaticResource x:Key="ComboBoxBorderBrush" ResourceKey="NormalBorderBrush" />
  43. <StaticResource x:Key="ComboBoxBorderBrushPointerOver" ResourceKey="PointerOverBorderBrush" />
  44. <StaticResource x:Key="ComboBoxBorderBrushPressed" ResourceKey="PressedBorderBrush" />
  45. <!-- Override colors for default theme -->
  46. <StaticResource x:Key="ThemeControlMidBrush" ResourceKey="NormalBackgroundBrush" />
  47. <StaticResource x:Key="ThemeControlHighBrush" ResourceKey="PressedBackgroundBrush" />
  48. <StaticResource x:Key="ThemeBorderLowBrush" ResourceKey="NormalBorderBrush" />
  49. <StaticResource x:Key="ThemeBorderMidBrush" ResourceKey="PointerOverBorderBrush" />
  50. </ResourceDictionary>
  51. </ResourceDictionary.ThemeDictionaries>
  52. </ResourceDictionary>
  53. </UserControl.Resources>
  54. <ThemeVariantScope x:Name="ThemeVariantScope">
  55. <Border Background="{DynamicResource DemoBackground}"
  56. VerticalAlignment="Top"
  57. HorizontalAlignment="Left"
  58. Padding="4"
  59. CornerRadius="4">
  60. <Grid RowDefinitions="Auto, 4, Auto, 4, Auto, 4, Auto" ColumnDefinitions="150, 150">
  61. <ComboBox Grid.Column="0" Grid.Row="0" x:Name="Selector" HorizontalAlignment="Stretch">
  62. <ComboBox.ItemTemplate>
  63. <DataTemplate x:DataType="x:String">
  64. <TextBlock Text="{Binding TargetNullValue=Unset}" />
  65. </DataTemplate>
  66. </ComboBox.ItemTemplate>
  67. </ComboBox>
  68. <TextBlock Grid.Column="0" Grid.Row="2" Text="Username:" VerticalAlignment="Center" />
  69. <TextBlock Grid.Column="0" Grid.Row="4" Text="Password:" VerticalAlignment="Center" />
  70. <TextBox Grid.Column="1" Grid.Row="2" Watermark="Input here" HorizontalAlignment="Stretch" />
  71. <TextBox Grid.Column="1" Grid.Row="4" Watermark="Input here" HorizontalAlignment="Stretch" />
  72. <Button Grid.Column="1" Grid.Row="6" Content="Login" HorizontalAlignment="Stretch" />
  73. </Grid>
  74. </Border>
  75. </ThemeVariantScope>
  76. </UserControl>