Refactor Gallery Controls register method

This commit is contained in:
chinboy
2025-12-01 12:27:25 +08:00
parent 5e7f5425c6
commit 8d264cb33b
7 changed files with 25 additions and 23 deletions
@@ -2,15 +2,4 @@
x:Class="AtomUIGallery.BaseGalleryApplication"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Styles>
<Styles>
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="Controls/Controls.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
</Styles>
</Application.Styles>
</Application>
@@ -1,11 +0,0 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="ShowCaseItem.axaml" />
<ResourceInclude Source="ShowCasePanel.axaml" />
<ResourceInclude Source="ColorItemControl.axaml" />
<ResourceInclude Source="ColorListControl.axaml" />
<ResourceInclude Source="IconGallery.axaml" />
<ResourceInclude Source="IconInfoItem.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
@@ -0,0 +1,14 @@
<atom:ControlThemesProvider xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:atom="https://atomui.net"
x:Class="AtomUIGallery.Controls.GalleryControlThemesProvider"
Id="AtomUIGallery.Controls">
<atom:ControlThemesProvider.ControlThemes>
<ResourceInclude Source="ShowCaseItem.axaml" />
<ResourceInclude Source="ShowCasePanel.axaml" />
<ResourceInclude Source="ColorItemControl.axaml" />
<ResourceInclude Source="ColorListControl.axaml" />
<ResourceInclude Source="IconGallery.axaml" />
<ResourceInclude Source="IconInfoItem.axaml" />
</atom:ControlThemesProvider.ControlThemes>
</atom:ControlThemesProvider>
@@ -0,0 +1,7 @@
using AtomUI.Theme;
namespace AtomUIGallery.Controls;
internal class GalleryControlThemesProvider : ControlThemesProvider
{
}
@@ -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)
{
@@ -1,6 +1,6 @@
using AtomUI.Theme;
namespace AtomUI.Desktop.Controls;
namespace AtomUIGallery.Controls;
internal class DesktopControlThemesProvider : ControlThemesProvider
{
@@ -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;