Add OverlayPopupHost Themes

This commit is contained in:
CHINBOY
2025-07-04 10:11:44 +08:00
parent 427b4a3ae8
commit 60bbcdccd0
3 changed files with 45 additions and 2 deletions
@@ -0,0 +1,28 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="using:AtomUI.Controls.Themes"
xmlns:atom="https://atomui.net">
<ControlTheme x:Key="{x:Type OverlayPopupHost}" TargetType="OverlayPopupHost">
<Setter Property="Template">
<ControlTemplate>
<LayoutTransformControl LayoutTransform="{TemplateBinding Transform}">
<VisualLayerManager IsPopup="True">
<ContentPresenter Name="{x:Static themes:OverlayPopupHostThemeConstants.ContentPresenterPart}"
Background="{TemplateBinding Background}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}" />
</VisualLayerManager>
</LayoutTransformControl>
</ControlTemplate>
</Setter>
<Setter Property="Foreground" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorText}}" />
<Setter Property="FontSize" Value="{DynamicResource {x:Static atom:SharedTokenKey.FontSize}}" />
<Setter Property="FontFamily" Value="{DynamicResource {x:Static atom:SharedTokenKey.FontFamily}}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontStyle" Value="Normal" />
</ControlTheme>
</ResourceDictionary>
@@ -1,7 +1,8 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="using:AtomUI.Controls.Themes">
xmlns:themes="using:AtomUI.Controls.Themes"
xmlns:atom="https://atomui.net">
<ControlTheme x:Key="{x:Type PopupRoot}" TargetType="PopupRoot">
<Setter Property="Template">
<ControlTemplate>
@@ -20,5 +21,14 @@
</LayoutTransformControl>
</ControlTemplate>
</Setter>
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorText}}" />
<Setter Property="TransparencyLevelHint" Value="Transparent" />
<Setter Property="FontSize" Value="{DynamicResource {x:Static atom:SharedTokenKey.FontSize}}" />
<Setter Property="FontFamily" Value="{DynamicResource {x:Static atom:SharedTokenKey.FontFamily}}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontStyle" Value="Normal" />
</ControlTheme>
</ResourceDictionary>
@@ -1,7 +1,12 @@
namespace AtomUI.Controls.Themes;
public static class PopupThemeConstants
internal static class PopupThemeConstants
{
public const string TransparencyFallbackPart = "PART_TransparencyFallback";
public const string ContentPresenterPart = "PART_ContentPresenter";
}
internal static class OverlayPopupHostThemeConstants
{
public const string ContentPresenterPart = "PART_ContentPresenter";
}