From 8d264cb33bde80c2b40b574aeb82dbcb4253c990 Mon Sep 17 00:00:00 2001 From: chinboy Date: Mon, 1 Dec 2025 12:27:25 +0800 Subject: [PATCH] Refactor Gallery Controls register method --- .../AtomUIGallery/BaseGalleryApplication.axaml | 11 ----------- .../AtomUIGallery/Controls/Controls.axaml | 11 ----------- .../Controls/GalleryControlThemesProvider.axaml | 14 ++++++++++++++ .../Controls/GalleryControlThemesProvider.cs | 7 +++++++ .../AtomUIGallery/ThemeManagerBuilderExtensions.cs | 2 ++ .../DesktopControlThemesProvider.cs | 2 +- .../ThemeManagerBuilderExtensions.cs | 1 + 7 files changed, 25 insertions(+), 23 deletions(-) delete mode 100644 controlgallery/AtomUIGallery/Controls/Controls.axaml create mode 100644 controlgallery/AtomUIGallery/Controls/GalleryControlThemesProvider.axaml create mode 100644 controlgallery/AtomUIGallery/Controls/GalleryControlThemesProvider.cs diff --git a/controlgallery/AtomUIGallery/BaseGalleryApplication.axaml b/controlgallery/AtomUIGallery/BaseGalleryApplication.axaml index a9c362e26..e598f4a84 100644 --- a/controlgallery/AtomUIGallery/BaseGalleryApplication.axaml +++ b/controlgallery/AtomUIGallery/BaseGalleryApplication.axaml @@ -2,15 +2,4 @@ x:Class="AtomUIGallery.BaseGalleryApplication" xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - - - - - - - - - - - \ No newline at end of file diff --git a/controlgallery/AtomUIGallery/Controls/Controls.axaml b/controlgallery/AtomUIGallery/Controls/Controls.axaml deleted file mode 100644 index 4b22912b0..000000000 --- a/controlgallery/AtomUIGallery/Controls/Controls.axaml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/controlgallery/AtomUIGallery/Controls/GalleryControlThemesProvider.axaml b/controlgallery/AtomUIGallery/Controls/GalleryControlThemesProvider.axaml new file mode 100644 index 000000000..3685652c9 --- /dev/null +++ b/controlgallery/AtomUIGallery/Controls/GalleryControlThemesProvider.axaml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/controlgallery/AtomUIGallery/Controls/GalleryControlThemesProvider.cs b/controlgallery/AtomUIGallery/Controls/GalleryControlThemesProvider.cs new file mode 100644 index 000000000..878007891 --- /dev/null +++ b/controlgallery/AtomUIGallery/Controls/GalleryControlThemesProvider.cs @@ -0,0 +1,7 @@ +using AtomUI.Theme; + +namespace AtomUIGallery.Controls; + +internal class GalleryControlThemesProvider : ControlThemesProvider +{ +} \ No newline at end of file diff --git a/controlgallery/AtomUIGallery/ThemeManagerBuilderExtensions.cs b/controlgallery/AtomUIGallery/ThemeManagerBuilderExtensions.cs index ef832fe58..5508b91e7 100644 --- a/controlgallery/AtomUIGallery/ThemeManagerBuilderExtensions.cs +++ b/controlgallery/AtomUIGallery/ThemeManagerBuilderExtensions.cs @@ -1,5 +1,6 @@ using AtomUI.Theme; using AtomUI.Theme.Language; +using AtomUIGallery.Controls; namespace AtomUIGallery; @@ -7,6 +8,7 @@ public static class ThemeManagerBuilderExtensions { public static IThemeManagerBuilder UseGalleryControls(this IThemeManagerBuilder themeManagerBuilder) { + themeManagerBuilder.AddControlThemesProvider(new GalleryControlThemesProvider()); var languageProviders = LanguageProviderPool.GetLanguageProviders(); foreach (var languageProvider in languageProviders) { diff --git a/src/AtomUI.Desktop.Controls/DesktopControlThemesProvider.cs b/src/AtomUI.Desktop.Controls/DesktopControlThemesProvider.cs index e9f4fd748..d2e0697f9 100644 --- a/src/AtomUI.Desktop.Controls/DesktopControlThemesProvider.cs +++ b/src/AtomUI.Desktop.Controls/DesktopControlThemesProvider.cs @@ -1,6 +1,6 @@ using AtomUI.Theme; -namespace AtomUI.Desktop.Controls; +namespace AtomUIGallery.Controls; internal class DesktopControlThemesProvider : ControlThemesProvider { diff --git a/src/AtomUI.Desktop.Controls/ThemeManagerBuilderExtensions.cs b/src/AtomUI.Desktop.Controls/ThemeManagerBuilderExtensions.cs index ec1d9d896..e22898643 100644 --- a/src/AtomUI.Desktop.Controls/ThemeManagerBuilderExtensions.cs +++ b/src/AtomUI.Desktop.Controls/ThemeManagerBuilderExtensions.cs @@ -2,6 +2,7 @@ using AtomUI.Controls; using AtomUI.MotionScene; using AtomUI.Theme; using AtomUI.Theme.Language; +using AtomUIGallery.Controls; using Avalonia; using Avalonia.Animation; using Avalonia.Media.Transformation;