From 34010db7fc2fca468828f894fb84a70bbc201a53 Mon Sep 17 00:00:00 2001 From: Mike James Date: Mon, 13 Jul 2026 10:33:23 +0200 Subject: [PATCH] Add Avalonia.Themes.Fluent2: baseline copy of Avalonia.Themes.Fluent Verbatim copy of the v1 Fluent theme renamed to Fluent2Theme / Avalonia.Themes.Fluent2, as the starting point for the Fluent 2 (WinUI 3 visual language) re-skin. No visual changes in this commit. Co-Authored-By: Claude Fable 5 --- Avalonia.slnx | 1 + .../Accents/BaseColorsPalette.xaml | 70 + .../Accents/BaseResources.xaml | 380 ++++ .../Accents/FluentControlResources.xaml | 1659 +++++++++++++++++ .../Accents/SystemAccentColors.cs | 160 ++ .../Avalonia.Themes.Fluent2.csproj | 16 + .../ColorPaletteResources.Properties.cs | 158 ++ .../ColorPaletteResources.cs | 119 ++ .../ColorPaletteResourcesCollection.cs | 148 ++ .../Controls/AdornerLayer.xaml | 20 + .../Controls/AutoCompleteBox.xaml | 80 + .../Controls/Button.xaml | 96 + .../Controls/ButtonSpinner.xaml | 156 ++ .../Controls/Calendar.xaml | 42 + .../Controls/CalendarButton.xaml | 116 ++ .../Controls/CalendarDatePicker.xaml | 180 ++ .../Controls/CalendarDayButton.xaml | 111 ++ .../Controls/CalendarItem.xaml | 163 ++ .../Controls/Carousel.xaml | 21 + .../Controls/CarouselPage.xaml | 30 + .../Controls/CheckBox.xaml | 304 +++ .../Controls/ComboBox.xaml | 260 +++ .../Controls/ComboBoxItem.xaml | 87 + .../Controls/CommandBar.xaml | 332 ++++ .../Controls/ContentPage.xaml | 42 + .../Controls/ContextMenu.xaml | 68 + .../Controls/DataValidationErrors.xaml | 113 ++ .../Controls/DatePicker.xaml | 262 +++ .../Controls/DateTimePickerShared.xaml | 117 ++ .../Controls/DrawerPage.xaml | 259 +++ .../Controls/DropDownButton.xaml | 106 ++ .../Controls/EmbeddableControlRoot.xaml | 26 + .../Controls/Expander.xaml | 337 ++++ .../Controls/FluentControls.xaml | 87 + .../Controls/FlyoutPresenter.xaml | 42 + .../Controls/GridSplitter.xaml | 23 + .../Controls/GroupBox.xaml | 90 + .../Controls/HeaderedContentControl.xaml | 42 + .../Controls/HyperlinkButton.xaml | 91 + .../Controls/ItemsControl.xaml | 18 + .../Controls/Label.xaml | 26 + .../Controls/ListBox.xaml | 50 + .../Controls/ListBoxItem.xaml | 78 + .../Controls/ManagedFileChooser.xaml | 389 ++++ .../Controls/Menu.xaml | 114 ++ .../Controls/MenuFlyoutPresenter.xaml | 43 + .../Controls/MenuItem.xaml | 261 +++ .../Controls/MenuScrollViewer.xaml | 93 + .../Controls/NavigationPage.xaml | 222 +++ .../Controls/NotificationCard.xaml | 99 + .../Controls/NumericUpDown.xaml | 101 + .../Controls/OverlayPopupHost.xaml | 25 + .../Controls/PathIcon.xaml | 26 + .../Controls/PipsPager.xaml | 351 ++++ .../Controls/PopupRoot.xaml | 30 + .../Controls/ProgressBar.xaml | 198 ++ .../Controls/RadioButton.xaml | 175 ++ .../Controls/RefreshContainer.xaml | 25 + .../Controls/RefreshVisualizer.xaml | 31 + .../Controls/RepeatButton.xaml | 61 + .../Controls/ScrollBar.xaml | 297 +++ .../Controls/ScrollViewer.xaml | 71 + .../Controls/SelectableTextBlock.xaml | 21 + .../Controls/Separator.xaml | 23 + .../Controls/Slider.xaml | 376 ++++ .../Controls/SplitButton.xaml | 206 ++ .../Controls/SplitView.xaml | 455 +++++ .../Controls/TabControl.xaml | 64 + .../Controls/TabItem.xaml | 131 ++ .../Controls/TabStrip.xaml | 33 + .../Controls/TabStripItem.xaml | 95 + .../Controls/TabbedPage.xaml | 262 +++ .../Controls/TextBox.xaml | 282 +++ .../Controls/TextSelectionHandle.xaml | 118 ++ .../Controls/ThemeVariantScope.xaml | 8 + .../Controls/TimePicker.xaml | 319 ++++ .../Controls/ToggleButton.xaml | 123 ++ .../Controls/ToggleSwitch.xaml | 266 +++ .../Controls/ToolTip.xaml | 59 + .../Controls/TransitioningContentControl.xaml | 30 + .../Controls/TreeView.xaml | 45 + .../Controls/TreeViewItem.xaml | 178 ++ .../Controls/Window.xaml | 29 + .../Controls/WindowDrawnDecorations.xaml | 224 +++ .../Controls/WindowNotificationManager.xaml | 68 + .../DensityStyles/Compact.xaml | 26 + src/Avalonia.Themes.Fluent2/Fluent2Theme.xaml | 27 + .../Fluent2Theme.xaml.cs | 82 + .../Properties/AssemblyInfo.cs | 3 + .../Strings/InvariantResources.xaml | 29 + 90 files changed, 12780 insertions(+) create mode 100644 src/Avalonia.Themes.Fluent2/Accents/BaseColorsPalette.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Accents/BaseResources.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Accents/SystemAccentColors.cs create mode 100644 src/Avalonia.Themes.Fluent2/Avalonia.Themes.Fluent2.csproj create mode 100644 src/Avalonia.Themes.Fluent2/ColorPaletteResources.Properties.cs create mode 100644 src/Avalonia.Themes.Fluent2/ColorPaletteResources.cs create mode 100644 src/Avalonia.Themes.Fluent2/ColorPaletteResourcesCollection.cs create mode 100644 src/Avalonia.Themes.Fluent2/Controls/AdornerLayer.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/AutoCompleteBox.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/Button.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ButtonSpinner.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/Calendar.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/CalendarButton.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/CalendarDatePicker.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/CalendarDayButton.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/CalendarItem.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/Carousel.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/CarouselPage.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/CheckBox.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ComboBox.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ComboBoxItem.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/CommandBar.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ContentPage.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ContextMenu.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/DataValidationErrors.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/DatePicker.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/DateTimePickerShared.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/DrawerPage.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/DropDownButton.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/EmbeddableControlRoot.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/Expander.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/FluentControls.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/FlyoutPresenter.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/GridSplitter.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/GroupBox.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/HeaderedContentControl.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/HyperlinkButton.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ItemsControl.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/Label.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ListBox.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ListBoxItem.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ManagedFileChooser.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/Menu.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/MenuFlyoutPresenter.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/MenuItem.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/MenuScrollViewer.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/NavigationPage.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/NotificationCard.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/NumericUpDown.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/OverlayPopupHost.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/PathIcon.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/PipsPager.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/PopupRoot.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ProgressBar.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/RadioButton.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/RefreshContainer.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/RefreshVisualizer.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/RepeatButton.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ScrollBar.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ScrollViewer.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/SelectableTextBlock.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/Separator.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/Slider.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/SplitButton.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/SplitView.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TabControl.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TabItem.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TabStrip.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TabStripItem.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TabbedPage.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TextBox.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TextSelectionHandle.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ThemeVariantScope.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TimePicker.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ToggleButton.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ToggleSwitch.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/ToolTip.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TransitioningContentControl.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TreeView.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/TreeViewItem.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/Window.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/WindowDrawnDecorations.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Controls/WindowNotificationManager.xaml create mode 100644 src/Avalonia.Themes.Fluent2/DensityStyles/Compact.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Fluent2Theme.xaml create mode 100644 src/Avalonia.Themes.Fluent2/Fluent2Theme.xaml.cs create mode 100644 src/Avalonia.Themes.Fluent2/Properties/AssemblyInfo.cs create mode 100644 src/Avalonia.Themes.Fluent2/Strings/InvariantResources.xaml diff --git a/Avalonia.slnx b/Avalonia.slnx index 80b4042e7a..b702b0464d 100644 --- a/Avalonia.slnx +++ b/Avalonia.slnx @@ -155,6 +155,7 @@ + diff --git a/src/Avalonia.Themes.Fluent2/Accents/BaseColorsPalette.xaml b/src/Avalonia.Themes.Fluent2/Accents/BaseColorsPalette.xaml new file mode 100644 index 0000000000..620add9045 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Accents/BaseColorsPalette.xaml @@ -0,0 +1,70 @@ + + + + + #FFFFFFFF + #33FFFFFF + #99FFFFFF + #CCFFFFFF + #66FFFFFF + #FF000000 + #33000000 + #99000000 + #CC000000 + #66000000 + #FF171717 + #FF000000 + #33000000 + #66000000 + #CC000000 + #FFCCCCCC + #FF7A7A7A + #FFCCCCCC + #FFF2F2F2 + #FFE6E6E6 + #FFF2F2F2 + #FFFFFFFF + #FF767676 + #19000000 + #33000000 + #C50500 + #FFFFFFFF + #17000000 + #2E000000 + + + #FF000000 + #33000000 + #99000000 + #CC000000 + #66000000 + #FFFFFFFF + #33FFFFFF + #99FFFFFF + #CCFFFFFF + #66FFFFFF + #FFF2F2F2 + #FF000000 + #33000000 + #66000000 + #CC000000 + #FF333333 + #FF858585 + #FF767676 + #FF171717 + #FF1F1F1F + #FF2B2B2B + #FFFFFFFF + #FF767676 + #19FFFFFF + #33FFFFFF + #FFF000 + #FF000000 + #18FFFFFF + #30FFFFFF + + + + diff --git a/src/Avalonia.Themes.Fluent2/Accents/BaseResources.xaml b/src/Avalonia.Themes.Fluent2/Accents/BaseResources.xaml new file mode 100644 index 0000000000..5328a71b3c --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Accents/BaseResources.xaml @@ -0,0 +1,380 @@ + + fonts:Inter#Inter, $Default + 14 + + + True + 1 + 2 + 10,6,6,5 + 20 + 20 + 24 + 8,5,8,6 + + + 3 + 5 + + + scaleX(0.125) translateX(-2px) + scaleY(0.125) translateY(-2px) + + + + + + + 374 + 0,2,0,2 + 1 + -1,0,-1,0 + 32 + 64 + 456 + 0 + 1 + 0 + + 12,11,12,12 + 96 + 40 + 758 + + + 0 + + + 0,4,0,4 + + + 12,0,12,0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml b/src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml new file mode 100644 index 0000000000..80778a50db --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml @@ -0,0 +1,1659 @@ + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4 + 16 + 0,4,0,12 + 1 + + + + + + #FF681DA8 + + + + + + + + + + + + + + + + + + + 64 + 1 + 1 + 11,5,11,7 + Normal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0,4,0,4 + + + 0 + + + 4 + 0 + + + 1 + 32 + 0,0 + 12,0,0,0 + 12,4,12,4 + + + + + + + + + + + + + + + + + + 11,9,11,10 + 11,4,11,7 + + + 1 + + 32 + 2,0,2,0 + 8,4,8,7 + + + + + + + + + + + 0.5 + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + 12 + SemiBold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4 + 2 + 0 + + + + + + + + + + + + + + + + + + + + + + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 12 + 1 + + + + 8,5,8,7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 24 + 12,0,12,0 + 12,0,12,0 + SemiLight + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + 16 + 8 + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4 + 16 + 0,4,0,12 + 1 + + + + + + #FFC58AF9 + + + + + + + + + + + + + + + + + + + 64 + 1 + 1 + 11,5,11,7 + Normal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0,4,0,4 + + + 0 + + + 4 + 0 + + + 1 + 32 + 0,0 + 12,0,0,0 + 12,4,12,4 + + + + + + + + + + + + + + + + + + 11,9,11,10 + 11,4,11,7 + + + 1 + + 32 + 2,0,2,0 + 8,4,8,7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + 12 + SemiBold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4 + 2 + 0 + + + + + + + + + + + + + + + + + + + + + + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 12 + 1 + + + + 8,5,8,7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 24 + 12,0,12,0 + 12,0,12,0 + SemiLight + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + 16 + 8 + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Accents/SystemAccentColors.cs b/src/Avalonia.Themes.Fluent2/Accents/SystemAccentColors.cs new file mode 100644 index 0000000000..aa1d9d7f88 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Accents/SystemAccentColors.cs @@ -0,0 +1,160 @@ +using System; +using Avalonia.Controls; +using Avalonia.Media; +using Avalonia.Platform; +using Avalonia.Styling; +using Avalonia.VisualTree; + +namespace Avalonia.Themes.Fluent2.Accents; + +internal sealed class SystemAccentColors : ResourceProvider +{ + public const string AccentKey = "SystemAccentColor"; + public const string AccentDark1Key = "SystemAccentColorDark1"; + public const string AccentDark2Key = "SystemAccentColorDark2"; + public const string AccentDark3Key = "SystemAccentColorDark3"; + public const string AccentLight1Key = "SystemAccentColorLight1"; + public const string AccentLight2Key = "SystemAccentColorLight2"; + public const string AccentLight3Key = "SystemAccentColorLight3"; + + private static readonly Color s_defaultSystemAccentColor = Color.FromRgb(0, 120, 215); + private bool _invalidateColors = true; + private Color _systemAccentColor; + private Color _systemAccentColorDark1, _systemAccentColorDark2, _systemAccentColorDark3; + private Color _systemAccentColorLight1, _systemAccentColorLight2, _systemAccentColorLight3; + + public override bool HasResources => true; + public override bool TryGetResource(object key, ThemeVariant? theme, out object? value) + { + if (key is string strKey) + { + if (strKey.Equals(AccentKey, StringComparison.InvariantCulture)) + { + EnsureColors(); + value = _systemAccentColor; + return true; + } + + if (strKey.Equals(AccentDark1Key, StringComparison.InvariantCulture)) + { + EnsureColors(); + value = _systemAccentColorDark1; + return true; + } + + if (strKey.Equals(AccentDark2Key, StringComparison.InvariantCulture)) + { + EnsureColors(); + value = _systemAccentColorDark2; + return true; + } + + if (strKey.Equals(AccentDark3Key, StringComparison.InvariantCulture)) + { + EnsureColors(); + value = _systemAccentColorDark3; + return true; + } + + if (strKey.Equals(AccentLight1Key, StringComparison.InvariantCulture)) + { + EnsureColors(); + value = _systemAccentColorLight1; + return true; + } + + if (strKey.Equals(AccentLight2Key, StringComparison.InvariantCulture)) + { + EnsureColors(); + value = _systemAccentColorLight2; + return true; + } + + if (strKey.Equals(AccentLight3Key, StringComparison.InvariantCulture)) + { + EnsureColors(); + value = _systemAccentColorLight3; + return true; + } + } + + value = null; + return false; + } + + protected override void OnAddOwner(IResourceHost owner) + { + if (GetFromOwner(owner) is { } platformSettings) + { + platformSettings.ColorValuesChanged += PlatformSettingsOnColorValuesChanged; + } + + _invalidateColors = true; + } + + protected override void OnRemoveOwner(IResourceHost owner) + { + if (GetFromOwner(owner) is { } platformSettings) + { + platformSettings.ColorValuesChanged -= PlatformSettingsOnColorValuesChanged; + } + + _invalidateColors = true; + } + + private void EnsureColors() + { + if (_invalidateColors) + { + _invalidateColors = false; + + var platformSettings = GetFromOwner(Owner); + + _systemAccentColor = platformSettings?.GetColorValues().AccentColor1 ?? s_defaultSystemAccentColor; + (_systemAccentColorDark1,_systemAccentColorDark2, _systemAccentColorDark3, + _systemAccentColorLight1, _systemAccentColorLight2, _systemAccentColorLight3) = CalculateAccentShades(_systemAccentColor); + } + } + + private static IPlatformSettings? GetFromOwner(IResourceHost? owner) + { + return owner switch + { + Application app => app.PlatformSettings, + Visual visual => visual.GetPlatformSettings(), + _ => null + }; + } + + public static (Color d1, Color d2, Color d3, Color l1, Color l2, Color l3) CalculateAccentShades(Color accentColor) + { + // dark1step = (hslAccent.L - SystemAccentColorDark1.L) * 255 + const double dark1step = 28.5 / 255d; + const double dark2step = 49 / 255d; + const double dark3step = 74.5 / 255d; + // light1step = (SystemAccentColorLight1.L - hslAccent.L) * 255 + const double light1step = 39 / 255d; + const double light2step = 70 / 255d; + const double light3step = 103 / 255d; + + var hslAccent = accentColor.ToHsl(); + + return ( + // Darker shades + new HslColor(hslAccent.A, hslAccent.H, hslAccent.S, hslAccent.L - dark1step).ToRgb(), + new HslColor(hslAccent.A, hslAccent.H, hslAccent.S, hslAccent.L - dark2step).ToRgb(), + new HslColor(hslAccent.A, hslAccent.H, hslAccent.S, hslAccent.L - dark3step).ToRgb(), + + // Lighter shades + new HslColor(hslAccent.A, hslAccent.H, hslAccent.S, hslAccent.L + light1step).ToRgb(), + new HslColor(hslAccent.A, hslAccent.H, hslAccent.S, hslAccent.L + light2step).ToRgb(), + new HslColor(hslAccent.A, hslAccent.H, hslAccent.S, hslAccent.L + light3step).ToRgb() + ); + } + + private void PlatformSettingsOnColorValuesChanged(object? sender, PlatformColorValues e) + { + _invalidateColors = true; + Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Create()); + } +} diff --git a/src/Avalonia.Themes.Fluent2/Avalonia.Themes.Fluent2.csproj b/src/Avalonia.Themes.Fluent2/Avalonia.Themes.Fluent2.csproj new file mode 100644 index 0000000000..814be0eb2b --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Avalonia.Themes.Fluent2.csproj @@ -0,0 +1,16 @@ + + + $(AvsCurrentTargetFramework);$(AvsLegacyTargetFrameworks) + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/ColorPaletteResources.Properties.cs b/src/Avalonia.Themes.Fluent2/ColorPaletteResources.Properties.cs new file mode 100644 index 0000000000..bc2fe5bc06 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/ColorPaletteResources.Properties.cs @@ -0,0 +1,158 @@ +using Avalonia.Media; + +namespace Avalonia.Themes.Fluent2; + +public partial class ColorPaletteResources +{ + private bool _hasAccentColor; + private Color _accentColor; + private Color _accentColorDark1, _accentColorDark2, _accentColorDark3; + private Color _accentColorLight1, _accentColorLight2, _accentColorLight3; + + public static readonly DirectProperty AccentProperty + = AvaloniaProperty.RegisterDirect(nameof(Accent), r => r.Accent, (r, v) => r.Accent = v); + + /// + /// Gets or sets the Accent color value. + /// + public Color Accent + { + get => _accentColor; + set => SetAndRaise(AccentProperty, ref _accentColor, value); + } + + /// + /// Gets or sets the AltHigh color value. + /// + public Color AltHigh { get => GetColor("SystemAltHighColor"); set => SetColor("SystemAltHighColor", value); } + + /// + /// Gets or sets the AltLow color value. + /// + public Color AltLow { get => GetColor("SystemAltLowColor"); set => SetColor("SystemAltLowColor", value); } + + /// + /// Gets or sets the AltMedium color value. + /// + public Color AltMedium { get => GetColor("SystemAltMediumColor"); set => SetColor("SystemAltMediumColor", value); } + + /// + /// Gets or sets the AltMediumHigh color value. + /// + public Color AltMediumHigh { get => GetColor("SystemAltMediumHighColor"); set => SetColor("SystemAltMediumHighColor", value); } + + /// + /// Gets or sets the AltMediumLow color value. + /// + public Color AltMediumLow { get => GetColor("SystemAltMediumLowColor"); set => SetColor("SystemAltMediumLowColor", value); } + + /// + /// Gets or sets the BaseHigh color value. + /// + public Color BaseHigh { get => GetColor("SystemBaseHighColor"); set => SetColor("SystemBaseHighColor", value); } + + /// + /// Gets or sets the BaseLow color value. + /// + public Color BaseLow { get => GetColor("SystemBaseLowColor"); set => SetColor("SystemBaseLowColor", value); } + + /// + /// Gets or sets the BaseMedium color value. + /// + public Color BaseMedium { get => GetColor("SystemBaseMediumColor"); set => SetColor("SystemBaseMediumColor", value); } + + /// + /// Gets or sets the BaseMediumHigh color value. + /// + public Color BaseMediumHigh { get => GetColor("SystemBaseMediumHighColor"); set => SetColor("SystemBaseMediumHighColor", value); } + + /// + /// Gets or sets the BaseMediumLow color value. + /// + public Color BaseMediumLow { get => GetColor("SystemBaseMediumLowColor"); set => SetColor("SystemBaseMediumLowColor", value); } + + /// + /// Gets or sets the ChromeAltLow color value. + /// + public Color ChromeAltLow { get => GetColor("SystemChromeAltLowColor"); set => SetColor("SystemChromeAltLowColor", value); } + + /// + /// Gets or sets the ChromeBlackHigh color value. + /// + public Color ChromeBlackHigh { get => GetColor("SystemChromeBlackHighColor"); set => SetColor("SystemChromeBlackHighColor", value); } + + /// + /// Gets or sets the ChromeBlackLow color value. + /// + public Color ChromeBlackLow { get => GetColor("SystemChromeBlackLowColor"); set => SetColor("SystemChromeBlackLowColor", value); } + + /// + /// Gets or sets the ChromeBlackMedium color value. + /// + public Color ChromeBlackMedium { get => GetColor("SystemChromeBlackMediumColor"); set => SetColor("SystemChromeBlackMediumColor", value); } + + /// + /// Gets or sets the ChromeBlackMediumLow color value. + /// + public Color ChromeBlackMediumLow { get => GetColor("SystemChromeBlackMediumLowColor"); set => SetColor("SystemChromeBlackMediumLowColor", value); } + + /// + /// Gets or sets the ChromeDisabledHigh color value. + /// + public Color ChromeDisabledHigh { get => GetColor("SystemChromeDisabledHighColor"); set => SetColor("SystemChromeDisabledHighColor", value); } + + /// + /// Gets or sets the ChromeDisabledLow color value. + /// + public Color ChromeDisabledLow { get => GetColor("SystemChromeDisabledLowColor"); set => SetColor("SystemChromeDisabledLowColor", value); } + + /// + /// Gets or sets the ChromeGray color value. + /// + public Color ChromeGray { get => GetColor("SystemChromeGrayColor"); set => SetColor("SystemChromeGrayColor", value); } + + /// + /// Gets or sets the ChromeHigh color value. + /// + public Color ChromeHigh { get => GetColor("SystemChromeHighColor"); set => SetColor("SystemChromeHighColor", value); } + + /// + /// Gets or sets the ChromeLow color value. + /// + public Color ChromeLow { get => GetColor("SystemChromeLowColor"); set => SetColor("SystemChromeLowColor", value); } + + /// + /// Gets or sets the ChromeMedium color value. + /// + public Color ChromeMedium { get => GetColor("SystemChromeMediumColor"); set => SetColor("SystemChromeMediumColor", value); } + + /// + /// Gets or sets the ChromeMediumLow color value. + /// + public Color ChromeMediumLow { get => GetColor("SystemChromeMediumLowColor"); set => SetColor("SystemChromeMediumLowColor", value); } + + /// + /// Gets or sets the ChromeWhite color value. + /// + public Color ChromeWhite { get => GetColor("SystemChromeWhiteColor"); set => SetColor("SystemChromeWhiteColor", value); } + + /// + /// Gets or sets the ErrorText color value. + /// + public Color ErrorText { get => GetColor("SystemErrorTextColor"); set => SetColor("SystemErrorTextColor", value); } + + /// + /// Gets or sets the ListLow color value. + /// + public Color ListLow { get => GetColor("SystemListLowColor"); set => SetColor("SystemListLowColor", value); } + + /// + /// Gets or sets the ListMedium color value. + /// + public Color ListMedium { get => GetColor("SystemListMediumColor"); set => SetColor("SystemListMediumColor", value); } + + /// + /// Gets or sets the RegionColor color value. + /// + public Color RegionColor { get => GetColor("SystemRegionColor"); set => SetColor("SystemRegionColor", value); } +} diff --git a/src/Avalonia.Themes.Fluent2/ColorPaletteResources.cs b/src/Avalonia.Themes.Fluent2/ColorPaletteResources.cs new file mode 100644 index 0000000000..1c87c9ed11 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/ColorPaletteResources.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Avalonia.Controls; +using Avalonia.Media; +using Avalonia.Styling; +using Avalonia.Themes.Fluent2.Accents; + +namespace Avalonia.Themes.Fluent2; + +/// +/// Represents a specialized resource dictionary that contains color resources used by Fluent2Theme elements. +/// +/// +/// This class can only be used in . +/// +public partial class ColorPaletteResources : ResourceProvider +{ + private readonly Dictionary _colors = new(StringComparer.InvariantCulture); + + public override bool HasResources => _hasAccentColor || _colors.Count > 0; + + public override bool TryGetResource(object key, ThemeVariant? theme, out object? value) + { + if (key is string strKey) + { + if (strKey.Equals(SystemAccentColors.AccentKey, StringComparison.InvariantCulture)) + { + value = _accentColor; + return _hasAccentColor; + } + + if (strKey.Equals(SystemAccentColors.AccentDark1Key, StringComparison.InvariantCulture)) + { + value = _accentColorDark1; + return _hasAccentColor; + } + + if (strKey.Equals(SystemAccentColors.AccentDark2Key, StringComparison.InvariantCulture)) + { + value = _accentColorDark2; + return _hasAccentColor; + } + + if (strKey.Equals(SystemAccentColors.AccentDark3Key, StringComparison.InvariantCulture)) + { + value = _accentColorDark3; + return _hasAccentColor; + } + + if (strKey.Equals(SystemAccentColors.AccentLight1Key, StringComparison.InvariantCulture)) + { + value = _accentColorLight1; + return _hasAccentColor; + } + + if (strKey.Equals(SystemAccentColors.AccentLight2Key, StringComparison.InvariantCulture)) + { + value = _accentColorLight2; + return _hasAccentColor; + } + + if (strKey.Equals(SystemAccentColors.AccentLight3Key, StringComparison.InvariantCulture)) + { + value = _accentColorLight3; + return _hasAccentColor; + } + + if (_colors.TryGetValue(strKey, out var color)) + { + value = color; + return true; + } + } + + value = null; + return false; + } + + private Color GetColor(string key) + { + if (_colors.TryGetValue(key, out var color)) + { + return color; + } + + return default; + } + + private void SetColor(string key, Color value) + { + if (value == default) + { + _colors.Remove(key); + } + else + { + _colors[key] = value; + } + } + + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) + { + base.OnPropertyChanged(change); + + if (change.Property == AccentProperty) + { + _hasAccentColor = _accentColor != default; + + if (_hasAccentColor) + { + (_accentColorDark1, _accentColorDark2, _accentColorDark3, + _accentColorLight1, _accentColorLight2, _accentColorLight3) = + SystemAccentColors.CalculateAccentShades(_accentColor); + } + RaiseResourcesChanged(); + } + } +} diff --git a/src/Avalonia.Themes.Fluent2/ColorPaletteResourcesCollection.cs b/src/Avalonia.Themes.Fluent2/ColorPaletteResourcesCollection.cs new file mode 100644 index 0000000000..1587d8b33f --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/ColorPaletteResourcesCollection.cs @@ -0,0 +1,148 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using Avalonia.Collections; +using Avalonia.Controls; +using Avalonia.Styling; + +namespace Avalonia.Themes.Fluent2; + +internal sealed class ColorPaletteResourcesCollection : ResourceProvider, IDictionary +{ + private readonly AvaloniaDictionary _inner; + + public ColorPaletteResourcesCollection() + { + _inner = new AvaloniaDictionary(2); + _inner.ForEachItem( + (key, x) => + { + if (Owner is not null) + { + ((IResourceProvider)x).AddOwner(Owner); + } + + if (key != ThemeVariant.Dark && key != ThemeVariant.Light) + { + throw new InvalidOperationException( + $"{nameof(Fluent2Theme)}.{nameof(Fluent2Theme.Palettes)} only supports Light and Dark variants."); + } + }, + (_, x) => + { + if (Owner is not null) + { + ((IResourceProvider)x).RemoveOwner(Owner); + } + }, + () => throw new NotSupportedException("Dictionary reset not supported")); + } + + public override bool HasResources => _inner.Count > 0; + public override bool TryGetResource(object key, ThemeVariant? theme, out object? value) + { + if (theme == null || theme == ThemeVariant.Default) + { + theme = ThemeVariant.Light; + } + + if (_inner.TryGetValue(theme, out var themePaletteResources) + && themePaletteResources.TryGetResource(key, theme, out value)) + { + return true; + } + + value = null; + return false; + } + + protected override void OnAddOwner(IResourceHost owner) + { + base.OnAddOwner(owner); + foreach (var palette in _inner.Values) + { + ((IResourceProvider)palette).AddOwner(owner); + } + } + + protected override void OnRemoveOwner(IResourceHost owner) + { + base.OnRemoveOwner(owner); + foreach (var palette in _inner.Values) + { + ((IResourceProvider)palette).RemoveOwner(owner); + } + } + + IEnumerator> IEnumerable>.GetEnumerator() + { + return _inner.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)_inner).GetEnumerator(); + } + + void ICollection>.Add(KeyValuePair item) + { + ((ICollection>)_inner).Add(item); + } + + void ICollection>.Clear() + { + _inner.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) + { + return ((ICollection>)_inner).Contains(item); + } + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) + { + _inner.CopyTo(array, arrayIndex); + } + + bool ICollection>.Remove(KeyValuePair item) + { + return ((ICollection>)_inner).Remove(item); + } + + int ICollection>.Count => _inner.Count; + + bool ICollection>.IsReadOnly => _inner.IsReadOnly; + + void IDictionary.Add(ThemeVariant key, ColorPaletteResources value) + { + _inner.Add(key, value); + } + + bool IDictionary.ContainsKey(ThemeVariant key) + { + return _inner.ContainsKey(key); + } + + bool IDictionary.Remove(ThemeVariant key) + { + return _inner.Remove(key); + } + + bool IDictionary.TryGetValue(ThemeVariant key, + [MaybeNullWhen(false)] + out ColorPaletteResources value) + { + return _inner.TryGetValue(key, out value); + } + + ColorPaletteResources IDictionary.this[ThemeVariant key] + { + get => _inner[key]; + set => _inner[key] = value; + } + + ICollection IDictionary.Keys => _inner.Keys; + + ICollection IDictionary.Values => _inner.Values; +} diff --git a/src/Avalonia.Themes.Fluent2/Controls/AdornerLayer.xaml b/src/Avalonia.Themes.Fluent2/Controls/AdornerLayer.xaml new file mode 100644 index 0000000000..fefa1ea055 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/AdornerLayer.xaml @@ -0,0 +1,20 @@ + + 0 + 2 + 1 + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/AutoCompleteBox.xaml b/src/Avalonia.Themes.Fluent2/Controls/AutoCompleteBox.xaml new file mode 100644 index 0000000000..bd9c84af17 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/AutoCompleteBox.xaml @@ -0,0 +1,80 @@ + + + + + + + Alabama + Alaska + Arizona + Arkansas + California + Colorado + Connecticut + Delaware + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/Button.xaml b/src/Avalonia.Themes.Fluent2/Controls/Button.xaml new file mode 100644 index 0000000000..7aea463352 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/Button.xaml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/Carousel.xaml b/src/Avalonia.Themes.Fluent2/Controls/Carousel.xaml new file mode 100644 index 0000000000..0ac46d00b2 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/Carousel.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/CarouselPage.xaml b/src/Avalonia.Themes.Fluent2/Controls/CarouselPage.xaml new file mode 100644 index 0000000000..6415084dc9 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/CarouselPage.xaml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/CheckBox.xaml b/src/Avalonia.Themes.Fluent2/Controls/CheckBox.xaml new file mode 100644 index 0000000000..d12dfd6149 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/CheckBox.xaml @@ -0,0 +1,304 @@ + + + + + Unchecked + Checked + Indeterminate + Checkbox should wrap its text + + + + + M5.5 10.586 1.707 6.793A1 1 0 0 0 .293 8.207l4.5 4.5a1 1 0 0 0 1.414 0l11-11A1 1 0 0 0 15.793.293L5.5 10.586Z + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ComboBox.xaml b/src/Avalonia.Themes.Fluent2/Controls/ComboBox.xaml new file mode 100644 index 0000000000..4d83049928 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ComboBox.xaml @@ -0,0 +1,260 @@ + + + + + + Item 1 + Item 2 + + + Item 1 + Item 2 + + + + + + + Error + + + + + + + Item A + Item b + Item c + + + + + + + + + + + Item A + Item b + Item c + + + + + + 0,0,0,4 + 15 + 7 + + 12,5,0,7 + 11,5,32,6 + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Transparent + Transparent + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ComboBoxItem.xaml b/src/Avalonia.Themes.Fluent2/Controls/ComboBoxItem.xaml new file mode 100644 index 0000000000..ea55770a51 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ComboBoxItem.xaml @@ -0,0 +1,87 @@ + + + + + + Item 1 + Item 2 long + Item 3 + Item 4 + Item 5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/CommandBar.xaml b/src/Avalonia.Themes.Fluent2/Controls/CommandBar.xaml new file mode 100644 index 0000000000..c1f8c16a2d --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/CommandBar.xaml @@ -0,0 +1,332 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ContentPage.xaml b/src/Avalonia.Themes.Fluent2/Controls/ContentPage.xaml new file mode 100644 index 0000000000..5ccbe8cf38 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ContentPage.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ContextMenu.xaml b/src/Avalonia.Themes.Fluent2/Controls/ContextMenu.xaml new file mode 100644 index 0000000000..50f4844271 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ContextMenu.xaml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 0,4,0,4 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/DataValidationErrors.xaml b/src/Avalonia.Themes.Fluent2/Controls/DataValidationErrors.xaml new file mode 100644 index 0000000000..94f1d3cdda --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/DataValidationErrors.xaml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/DatePicker.xaml b/src/Avalonia.Themes.Fluent2/Controls/DatePicker.xaml new file mode 100644 index 0000000000..1acb160a17 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/DatePicker.xaml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + Error + + + + + + + + + 40 + 40 + 41 + 296 + 456 + 0,3,0,6 + 9,3,0,6 + 0,3,0,6 + 9,3,0,6 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/DateTimePickerShared.xaml b/src/Avalonia.Themes.Fluent2/Controls/DateTimePickerShared.xaml new file mode 100644 index 0000000000..23082f143e --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/DateTimePickerShared.xaml @@ -0,0 +1,117 @@ + + + + + + + Standard Item + Month Item + Button + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/DrawerPage.xaml b/src/Avalonia.Themes.Fluent2/Controls/DrawerPage.xaml new file mode 100644 index 0000000000..e93d6c9022 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/DrawerPage.xaml @@ -0,0 +1,259 @@ + + + + + + + + + + M3 17h18a1 1 0 0 1 .117 1.993L21 19H3a1 1 0 0 1-.117-1.993L3 17h18H3Zm0-6 18-.002a1 1 0 0 1 .117 1.993l-.117.007L3 13a1 1 0 0 1-.117-1.993L3 11l18-.002L3 11Zm0-6h18a1 1 0 0 1 .117 1.993L21 7H3a1 1 0 0 1-.117-1.993L3 5h18H3Z + + 48 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/DropDownButton.xaml b/src/Avalonia.Themes.Fluent2/Controls/DropDownButton.xaml new file mode 100644 index 0000000000..ca8cb9941b --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/DropDownButton.xaml @@ -0,0 +1,106 @@ + + + + + + + + + + + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/EmbeddableControlRoot.xaml b/src/Avalonia.Themes.Fluent2/Controls/EmbeddableControlRoot.xaml new file mode 100644 index 0000000000..2ea83ec6a9 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/EmbeddableControlRoot.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/Expander.xaml b/src/Avalonia.Themes.Fluent2/Controls/Expander.xaml new file mode 100644 index 0000000000..55ed424e09 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/Expander.xaml @@ -0,0 +1,337 @@ + + + + + + + + Expanded content + + + + + Expanded content + + + + + Expanded content + + + + + Expanded content + + + + + + + + + + + Expanded content + + + + + Expanded content + + + + + + + + 48 + + + Stretch + Center + 16,0,0,0 + 1 + 0 + 20,0,8,0 + 32 + + + 16 + 1,1,0,1 + 1,1,1,0 + 0,1,1,1 + 1,0,1,1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/FluentControls.xaml b/src/Avalonia.Themes.Fluent2/Controls/FluentControls.xaml new file mode 100644 index 0000000000..45314f84ca --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/FluentControls.xaml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/FlyoutPresenter.xaml b/src/Avalonia.Themes.Fluent2/Controls/FlyoutPresenter.xaml new file mode 100644 index 0000000000..42ff4c4055 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/FlyoutPresenter.xaml @@ -0,0 +1,42 @@ + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/GridSplitter.xaml b/src/Avalonia.Themes.Fluent2/Controls/GridSplitter.xaml new file mode 100644 index 0000000000..fc08d6b0b6 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/GridSplitter.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/GroupBox.xaml b/src/Avalonia.Themes.Fluent2/Controls/GroupBox.xaml new file mode 100644 index 0000000000..5b31fdb55c --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/GroupBox.xaml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/HeaderedContentControl.xaml b/src/Avalonia.Themes.Fluent2/Controls/HeaderedContentControl.xaml new file mode 100644 index 0000000000..4474ac07ab --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/HeaderedContentControl.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/HyperlinkButton.xaml b/src/Avalonia.Themes.Fluent2/Controls/HyperlinkButton.xaml new file mode 100644 index 0000000000..8b390a988a --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/HyperlinkButton.xaml @@ -0,0 +1,91 @@ + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ItemsControl.xaml b/src/Avalonia.Themes.Fluent2/Controls/ItemsControl.xaml new file mode 100644 index 0000000000..07327b530c --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ItemsControl.xaml @@ -0,0 +1,18 @@ + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/Label.xaml b/src/Avalonia.Themes.Fluent2/Controls/Label.xaml new file mode 100644 index 0000000000..daf38c2829 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/Label.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ListBox.xaml b/src/Avalonia.Themes.Fluent2/Controls/ListBox.xaml new file mode 100644 index 0000000000..d777520ecf --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ListBox.xaml @@ -0,0 +1,50 @@ + + + + + Test + Test + Test + Test + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ListBoxItem.xaml b/src/Avalonia.Themes.Fluent2/Controls/ListBoxItem.xaml new file mode 100644 index 0000000000..5388344b4f --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ListBoxItem.xaml @@ -0,0 +1,78 @@ + + + + + Disabled + + Test + + Test + + + + 12,9,12,12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ManagedFileChooser.xaml b/src/Avalonia.Themes.Fluent2/Controls/ManagedFileChooser.xaml new file mode 100644 index 0000000000..c980135eca --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ManagedFileChooser.xaml @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/NotificationCard.xaml b/src/Avalonia.Themes.Fluent2/Controls/NotificationCard.xaml new file mode 100644 index 0000000000..6e9277df09 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/NotificationCard.xaml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/NumericUpDown.xaml b/src/Avalonia.Themes.Fluent2/Controls/NumericUpDown.xaml new file mode 100644 index 0000000000..bcd486534d --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/NumericUpDown.xaml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/PopupRoot.xaml b/src/Avalonia.Themes.Fluent2/Controls/PopupRoot.xaml new file mode 100644 index 0000000000..1ce4e63576 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/PopupRoot.xaml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ProgressBar.xaml b/src/Avalonia.Themes.Fluent2/Controls/ProgressBar.xaml new file mode 100644 index 0000000000..adb8551ec3 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ProgressBar.xaml @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/RadioButton.xaml b/src/Avalonia.Themes.Fluent2/Controls/RadioButton.xaml new file mode 100644 index 0000000000..e1609f5cc3 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/RadioButton.xaml @@ -0,0 +1,175 @@ + + + + + + + + + + + + + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/RefreshContainer.xaml b/src/Avalonia.Themes.Fluent2/Controls/RefreshContainer.xaml new file mode 100644 index 0000000000..b030acca30 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/RefreshContainer.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/RefreshVisualizer.xaml b/src/Avalonia.Themes.Fluent2/Controls/RefreshVisualizer.xaml new file mode 100644 index 0000000000..c5f993bb0e --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/RefreshVisualizer.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/RepeatButton.xaml b/src/Avalonia.Themes.Fluent2/Controls/RepeatButton.xaml new file mode 100644 index 0000000000..2d19ec79ee --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/RepeatButton.xaml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ScrollBar.xaml b/src/Avalonia.Themes.Fluent2/Controls/ScrollBar.xaml new file mode 100644 index 0000000000..8af22dd0b9 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ScrollBar.xaml @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ScrollViewer.xaml b/src/Avalonia.Themes.Fluent2/Controls/ScrollViewer.xaml new file mode 100644 index 0000000000..611c7dc49b --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ScrollViewer.xaml @@ -0,0 +1,71 @@ + + + + + Item 1 + Item 2 + Item 3 + Item 4 + Item 5 + Item 6 + Item 7 + Item 8 + Item 9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/SelectableTextBlock.xaml b/src/Avalonia.Themes.Fluent2/Controls/SelectableTextBlock.xaml new file mode 100644 index 0000000000..8e5d7bdb1c --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/SelectableTextBlock.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/Separator.xaml b/src/Avalonia.Themes.Fluent2/Controls/Separator.xaml new file mode 100644 index 0000000000..3b4a111a58 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/Separator.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/Slider.xaml b/src/Avalonia.Themes.Fluent2/Controls/Slider.xaml new file mode 100644 index 0000000000..c7e41e1a02 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/Slider.xaml @@ -0,0 +1,376 @@ + + + + + + + + + + + + + + + + Error + + + + + + + + + + + + + + + + + + 0,0,0,4 + 15 + 15 + 32 + 32 + 10 + 20 + 20 + 20 + 20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/SplitButton.xaml b/src/Avalonia.Themes.Fluent2/Controls/SplitButton.xaml new file mode 100644 index 0000000000..c62ad599d4 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/SplitButton.xaml @@ -0,0 +1,206 @@ + + + + + + + Hello + + + + + Hello + + + Disabled + + + Hello + + + + + Hello + + + + + + + + 32 + 32 + 1 + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/SplitView.xaml b/src/Avalonia.Themes.Fluent2/Controls/SplitView.xaml new file mode 100644 index 0000000000..1298318e9e --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/SplitView.xaml @@ -0,0 +1,455 @@ + + + + + + + + + + + + + + + 320 + 48 + 00:00:00.2 + 00:00:00.1 + 0.1,0.9,0.2,1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TabControl.xaml b/src/Avalonia.Themes.Fluent2/Controls/TabControl.xaml new file mode 100644 index 0000000000..123a1cff7d --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TabControl.xaml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + 0 0 0 2 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TabItem.xaml b/src/Avalonia.Themes.Fluent2/Controls/TabItem.xaml new file mode 100644 index 0000000000..7f7d71caed --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TabItem.xaml @@ -0,0 +1,131 @@ + + + + + + + + + + + + 48 + 24 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TabStrip.xaml b/src/Avalonia.Themes.Fluent2/Controls/TabStrip.xaml new file mode 100644 index 0000000000..ecaad94482 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TabStrip.xaml @@ -0,0 +1,33 @@ + + + + + Item 1 + Item 2 + Disabled + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TabStripItem.xaml b/src/Avalonia.Themes.Fluent2/Controls/TabStripItem.xaml new file mode 100644 index 0000000000..b9b0fc6026 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TabStripItem.xaml @@ -0,0 +1,95 @@ + + + + + Leaf + Arch + Background + + + + + 48 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TabbedPage.xaml b/src/Avalonia.Themes.Fluent2/Controls/TabbedPage.xaml new file mode 100644 index 0000000000..d19f8937ee --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TabbedPage.xaml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + 18 + + 0 + 0 + + + 48 + 0 + 8,4 + 0 + + + 20 + 12 + 4 + + + + 0 + 0 + + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TextBox.xaml b/src/Avalonia.Themes.Fluent2/Controls/TextBox.xaml new file mode 100644 index 0000000000..da70caa5c6 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TextBox.xaml @@ -0,0 +1,282 @@ + + + + + Left + Center + Clear + Reveal Password + Password Revealed + + + Content + + + + + 0,0,0,4 + M 11.416016,10 20,1.4160156 18.583984,0 10,8.5839846 1.4160156,0 0,1.4160156 8.5839844,10 0,18.583985 1.4160156,20 10,11.416015 18.583984,20 20,18.583985 Z + m10.051 7.0032c2.215 0 4.0105 1.7901 4.0105 3.9984s-1.7956 3.9984-4.0105 3.9984c-2.215 0-4.0105-1.7901-4.0105-3.9984s1.7956-3.9984 4.0105-3.9984zm0 1.4994c-1.3844 0-2.5066 1.1188-2.5066 2.499s1.1222 2.499 2.5066 2.499 2.5066-1.1188 2.5066-2.499-1.1222-2.499-2.5066-2.499zm0-5.0026c4.6257 0 8.6188 3.1487 9.7267 7.5613 0.10085 0.40165-0.14399 0.80877-0.54686 0.90931-0.40288 0.10054-0.81122-0.14355-0.91208-0.54521-0.94136-3.7492-4.3361-6.4261-8.2678-6.4261-3.9334 0-7.3292 2.6792-8.2689 6.4306-0.10063 0.40171-0.50884 0.64603-0.91177 0.54571s-0.648-0.5073-0.54737-0.90901c1.106-4.4152 5.1003-7.5667 9.728-7.5667z + m0.21967 0.21965c-0.26627 0.26627-0.29047 0.68293-0.07262 0.97654l0.07262 0.08412 4.0346 4.0346c-1.922 1.3495-3.3585 3.365-3.9554 5.7495-0.10058 0.4018 0.14362 0.8091 0.54543 0.9097 0.40182 0.1005 0.80909-0.1436 0.90968-0.5455 0.52947-2.1151 1.8371-3.8891 3.5802-5.0341l1.8096 1.8098c-0.70751 0.7215-1.1438 1.71-1.1438 2.8003 0 2.2092 1.7909 4 4 4 1.0904 0 2.0788-0.4363 2.8004-1.1438l5.9193 5.9195c0.2929 0.2929 0.7677 0.2929 1.0606 0 0.2663-0.2662 0.2905-0.6829 0.0726-0.9765l-0.0726-0.0841-6.1135-6.1142 0.0012-0.0015-1.2001-1.1979-2.8699-2.8693 2e-3 -8e-4 -2.8812-2.8782 0.0012-0.0018-1.1333-1.1305-4.3064-4.3058c-0.29289-0.29289-0.76777-0.29289-1.0607 0zm7.9844 9.0458 3.5351 3.5351c-0.45 0.4358-1.0633 0.704-1.7392 0.704-1.3807 0-2.5-1.1193-2.5-2.5 0-0.6759 0.26824-1.2892 0.7041-1.7391zm1.7959-5.7655c-1.0003 0-1.9709 0.14807-2.8889 0.425l1.237 1.2362c0.5358-0.10587 1.0883-0.16119 1.6519-0.16119 3.9231 0 7.3099 2.6803 8.2471 6.4332 0.1004 0.4018 0.5075 0.6462 0.9094 0.5459 0.4019-0.1004 0.6463-0.5075 0.5459-0.9094-1.103-4.417-5.0869-7.5697-9.7024-7.5697zm0.1947 3.5093 3.8013 3.8007c-0.1018-2.0569-1.7488-3.7024-3.8013-3.8007z + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TextSelectionHandle.xaml b/src/Avalonia.Themes.Fluent2/Controls/TextSelectionHandle.xaml new file mode 100644 index 0000000000..42020b14f7 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TextSelectionHandle.xaml @@ -0,0 +1,118 @@ + + + + + + + + + + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ThemeVariantScope.xaml b/src/Avalonia.Themes.Fluent2/Controls/ThemeVariantScope.xaml new file mode 100644 index 0000000000..6adc49493e --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ThemeVariantScope.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TimePicker.xaml b/src/Avalonia.Themes.Fluent2/Controls/TimePicker.xaml new file mode 100644 index 0000000000..27e52fa152 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TimePicker.xaml @@ -0,0 +1,319 @@ + + + + + + + + + + + + + + Error + + + + + + + + + 40 + 1 + 1 + 40 + 41 + 242 + 456 + 0,3,0,6 + 0,3,0,6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ToggleButton.xaml b/src/Avalonia.Themes.Fluent2/Controls/ToggleButton.xaml new file mode 100644 index 0000000000..2d536e098a --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ToggleButton.xaml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent2/Controls/ToggleSwitch.xaml new file mode 100644 index 0000000000..5a262d3d56 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ToggleSwitch.xaml @@ -0,0 +1,266 @@ + + + + + + + + + + + + + 0,0,0,6 + 6 + 6 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/ToolTip.xaml b/src/Avalonia.Themes.Fluent2/Controls/ToolTip.xaml new file mode 100644 index 0000000000..b3120301cb --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/ToolTip.xaml @@ -0,0 +1,59 @@ + + + + + Text Content + Very long text content which should exceed the maximum with of the tooltip and wrap. + + + Multi-line + Control Content + + + + + + + 320 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TransitioningContentControl.xaml b/src/Avalonia.Themes.Fluent2/Controls/TransitioningContentControl.xaml new file mode 100644 index 0000000000..03cb09e395 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TransitioningContentControl.xaml @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TreeView.xaml b/src/Avalonia.Themes.Fluent2/Controls/TreeView.xaml new file mode 100644 index 0000000000..24854694a8 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TreeView.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/TreeViewItem.xaml b/src/Avalonia.Themes.Fluent2/Controls/TreeViewItem.xaml new file mode 100644 index 0000000000..a1b22528c9 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/TreeViewItem.xaml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + 16 + 12 + 12, 0, 12, 0 + M 1,0 10,10 l -9,10 -1,-1 L 8,10 -0,1 Z + M0,1 L10,10 20,1 19,0 10,8 1,0 Z + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/Window.xaml b/src/Avalonia.Themes.Fluent2/Controls/Window.xaml new file mode 100644 index 0000000000..0f25079004 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/Window.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/WindowDrawnDecorations.xaml b/src/Avalonia.Themes.Fluent2/Controls/WindowDrawnDecorations.xaml new file mode 100644 index 0000000000..d9af9faf79 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/WindowDrawnDecorations.xaml @@ -0,0 +1,224 @@ + + + 45 + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Controls/WindowNotificationManager.xaml b/src/Avalonia.Themes.Fluent2/Controls/WindowNotificationManager.xaml new file mode 100644 index 0000000000..cbdd01bd6f --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Controls/WindowNotificationManager.xaml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/DensityStyles/Compact.xaml b/src/Avalonia.Themes.Fluent2/DensityStyles/Compact.xaml new file mode 100644 index 0000000000..f306a0795f --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/DensityStyles/Compact.xaml @@ -0,0 +1,26 @@ + + 14 + 24 + 32 + 4, 2 + 4,2 + 24 + 11,5,11,7 + 4 4 8 4 + 5, 2 + 24 + 0,1,0,2 + 0,1,0,2 + 9,0,0,1 + 10,0,30,0 + 24 + 12,1,0,3 + 32 + 28 + 6, 0 + 6,4 + 24 + 24 + diff --git a/src/Avalonia.Themes.Fluent2/Fluent2Theme.xaml b/src/Avalonia.Themes.Fluent2/Fluent2Theme.xaml new file mode 100644 index 0000000000..749c29a1e1 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Fluent2Theme.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent2/Fluent2Theme.xaml.cs b/src/Avalonia.Themes.Fluent2/Fluent2Theme.xaml.cs new file mode 100644 index 0000000000..58a7d0d3eb --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Fluent2Theme.xaml.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; +using Avalonia.Styling; + +namespace Avalonia.Themes.Fluent2 +{ + public enum DensityStyle + { + Normal, + Compact + } + + /// + /// Includes the fluent theme in an application. + /// + public class Fluent2Theme : Styles, IResourceNode + { + private readonly ResourceDictionary _compactStyles; + private DensityStyle _densityStyle; + + /// + /// Initializes a new instance of the class. + /// + /// The parent's service provider. + public Fluent2Theme(IServiceProvider? sp = null) + { + AvaloniaXamlLoader.Load(sp, this); + + _compactStyles = (ResourceDictionary)GetAndRemove("CompactStyles"); + + Palettes = Resources.MergedDictionaries.OfType().FirstOrDefault() + ?? throw new InvalidOperationException("Fluent2Theme was initialized with missing ColorPaletteResourcesCollection."); + + object GetAndRemove(string key) + { + var val = Resources[key] + ?? throw new KeyNotFoundException($"Key {key} was not found in the resources"); + Resources.Remove(key); + return val; + } + } + + public static readonly DirectProperty DensityStyleProperty = AvaloniaProperty.RegisterDirect( + nameof(DensityStyle), o => o.DensityStyle, (o, v) => o.DensityStyle = v); + + /// + /// Gets or sets the density style of the fluent theme (normal, compact). + /// + public DensityStyle DensityStyle + { + get => _densityStyle; + set => SetAndRaise(DensityStyleProperty, ref _densityStyle, value); + } + + public IDictionary Palettes { get; } + + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) + { + base.OnPropertyChanged(change); + + if (change.Property == DensityStyleProperty) + { + Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Create()); + } + } + + bool IResourceNode.TryGetResource(object key, ThemeVariant? theme, out object? value) + { + // DensityStyle dictionary should be checked first + if (_densityStyle == DensityStyle.Compact + && _compactStyles.TryGetResource(key, theme, out value)) + { + return true; + } + + return base.TryGetResource(key, theme, out value); + } + } +} diff --git a/src/Avalonia.Themes.Fluent2/Properties/AssemblyInfo.cs b/src/Avalonia.Themes.Fluent2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..370c66b4b0 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using Avalonia.Metadata; + +[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Themes.Fluent2")] diff --git a/src/Avalonia.Themes.Fluent2/Strings/InvariantResources.xaml b/src/Avalonia.Themes.Fluent2/Strings/InvariantResources.xaml new file mode 100644 index 0000000000..2e7c1687e9 --- /dev/null +++ b/src/Avalonia.Themes.Fluent2/Strings/InvariantResources.xaml @@ -0,0 +1,29 @@ + + + day + month + year + + hour + minute + second + + Cut + Copy + Paste + + File name + Show hidden files + OK + Cancel + Name + Date Modified + Type + Size + {0} already exists. Do you want to replace it? + Yes + No + +