diff --git a/src/Ursa.Themes.Semi/Controls/DualBadge.axaml b/src/Ursa.Themes.Semi/Controls/DualBadge.axaml
index fa9a31f..80b36f0 100644
--- a/src/Ursa.Themes.Semi/Controls/DualBadge.axaml
+++ b/src/Ursa.Themes.Semi/Controls/DualBadge.axaml
@@ -19,40 +19,38 @@
+ VerticalAlignment="{TemplateBinding VerticalAlignment}"
+ ClipToBounds="True"
+ CornerRadius="{TemplateBinding CornerRadius}">
-
-
-
-
-
-
+ Background="{TemplateBinding HeaderBackground}">
+
+
+
@@ -60,5 +58,9 @@
+
+
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Themes/Shared/DualBadge.axaml b/src/Ursa.Themes.Semi/Themes/Shared/DualBadge.axaml
index ce2a09b..c08cf04 100644
--- a/src/Ursa.Themes.Semi/Themes/Shared/DualBadge.axaml
+++ b/src/Ursa.Themes.Semi/Themes/Shared/DualBadge.axaml
@@ -1,6 +1,5 @@
- 4 0 0 4
- 0 4 4 0
+ 4
12
1
4 2
diff --git a/src/Ursa/Controls/DualBadge.cs b/src/Ursa/Controls/DualBadge.cs
index de02345..9e445c6 100644
--- a/src/Ursa/Controls/DualBadge.cs
+++ b/src/Ursa/Controls/DualBadge.cs
@@ -1,4 +1,5 @@
using Avalonia;
+using Avalonia.Controls;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
@@ -7,9 +8,13 @@ using Avalonia.Media;
namespace Ursa.Controls;
+[PseudoClasses(PC_IconEmpty, PC_HeaderEmpty, PC_ContentEmpty)]
[TemplatePart(PART_Icon, typeof(ContentPresenter))]
public class DualBadge : HeaderedContentControl
{
+ public const string PC_IconEmpty = ":icon-empty";
+ public const string PC_HeaderEmpty = ":header-empty";
+ public const string PC_ContentEmpty = ":content-empty";
public const string PART_HeaderPresenter = "PART_HeaderPresenter";
public const string PART_ContentPresenter = "PART_ContentPresenter";
public const string PART_Icon = "PART_Icon";
@@ -58,4 +63,57 @@ public class DualBadge : HeaderedContentControl
get => GetValue(HeaderBackgroundProperty);
set => SetValue(HeaderBackgroundProperty, value);
}
+
+ public static readonly StyledProperty IsIconEmptyProperty = AvaloniaProperty.Register(
+ nameof(IsIconEmpty));
+
+ public bool IsIconEmpty
+ {
+ get => GetValue(IsIconEmptyProperty);
+ set => SetValue(IsIconEmptyProperty, value);
+ }
+
+ public static readonly StyledProperty IsHeaderEmptyProperty = AvaloniaProperty.Register(
+ nameof(IsHeaderEmpty));
+
+ public bool IsHeaderEmpty
+ {
+ get => GetValue(IsHeaderEmptyProperty);
+ set => SetValue(IsHeaderEmptyProperty, value);
+ }
+
+ public static readonly StyledProperty IsContentEmptyProperty = AvaloniaProperty.Register(
+ nameof(IsContentEmpty));
+
+ public bool IsContentEmpty
+ {
+ get => GetValue(IsContentEmptyProperty);
+ set => SetValue(IsContentEmptyProperty, value);
+ }
+
+
+ static DualBadge()
+ {
+ IsIconEmptyProperty.Changed.AddClassHandler((o, e) => o.OnIsIconEmptyChanged(e));
+ IsHeaderEmptyProperty.Changed.AddClassHandler((o, e) => o.OnIsHeaderEmptyChanged(e));
+ IsContentEmptyProperty.Changed.AddClassHandler((o, e) => o.OnIsContentEmptyChanged(e));
+ }
+
+ private void OnIsIconEmptyChanged(AvaloniaPropertyChangedEventArgs args)
+ {
+ bool newValue = args.GetNewValue();
+ PseudoClasses.Set(PC_IconEmpty, newValue);
+ }
+
+ private void OnIsHeaderEmptyChanged(AvaloniaPropertyChangedEventArgs args)
+ {
+ bool newValue = args.GetNewValue();
+ PseudoClasses.Set(PC_HeaderEmpty, newValue);
+ }
+
+ private void OnIsContentEmptyChanged(AvaloniaPropertyChangedEventArgs args)
+ {
+ bool newValue = args.GetNewValue();
+ PseudoClasses.Set(PC_ContentEmpty, newValue);
+ }
}
\ No newline at end of file