diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.cs
index 78691683a3a1..dc6d9b68ce69 100644
--- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.cs
+++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.cs
@@ -1,108 +1,109 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
-// MUX reference InfoBadge.cpp, commit 76bd573
+// MUX reference InfoBadge.cpp, tag winui3/release/1.4.2
using System;
-using Uno.UI.Helpers.WinUI;
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
-namespace Microsoft.UI.Xaml.Controls
+namespace Microsoft.UI.Xaml.Controls;
+
+///
+/// Represents a control for indicating notifications, alerts, new content, or to attract focus to an area within an app.
+///
+public partial class InfoBadge : Control
{
- public partial class InfoBadge : Control
+ //private const string IconPresenterName = "IconPresenter";
+
+ ///
+ /// Initializes a new instance of the InfoBadge class.
+ ///
+ public InfoBadge()
{
- //private const string IconPresenterName = "IconPresenter";
+ DefaultStyleKey = typeof(InfoBadge);
- public InfoBadge()
- {
- DefaultStyleKey = typeof(InfoBadge);
+ SetValue(TemplateSettingsProperty, new InfoBadgeTemplateSettings());
+ SizeChanged += OnSizeChanged;
+ }
- SetValue(TemplateSettingsProperty, new InfoBadgeTemplateSettings());
- SizeChanged += OnSizeChanged;
- }
+ protected override void OnApplyTemplate()
+ {
+ OnDisplayKindPropertiesChanged();
+ }
- protected override void OnApplyTemplate()
+ protected override Size MeasureOverride(Size availableSize)
+ {
+ var defaultDesiredSize = base.MeasureOverride(availableSize);
+ if (defaultDesiredSize.Width < defaultDesiredSize.Height)
{
- OnDisplayKindPropertiesChanged();
+ return new Size(defaultDesiredSize.Height, defaultDesiredSize.Height);
}
+ return defaultDesiredSize;
+ }
+
+ private void OnPropertyChanged(DependencyPropertyChangedEventArgs args)
+ {
+ var property = args.Property;
+ Control thisAsControl = this;
- protected override Size MeasureOverride(Size availableSize)
+ if (property == ValueProperty)
{
- var defaultDesiredSize = base.MeasureOverride(availableSize);
- if (defaultDesiredSize.Width < defaultDesiredSize.Height)
+ if (Value < -1)
{
- return new Size(defaultDesiredSize.Height, defaultDesiredSize.Height);
+ throw new ArgumentOutOfRangeException("Value must be equal to or greater than -1");
}
- return defaultDesiredSize;
}
- private void OnPropertyChanged(DependencyPropertyChangedEventArgs args)
+ if (property == ValueProperty || property == IconSourceProperty)
{
- var property = args.Property;
- Control thisAsControl = this;
-
- if (property == ValueProperty)
- {
- if (Value < -1)
- {
- throw new ArgumentOutOfRangeException("Value must be equal to or greater than -1");
- }
- }
-
- if (property == ValueProperty || property == IconSourceProperty)
- {
- OnDisplayKindPropertiesChanged();
- }
+ OnDisplayKindPropertiesChanged();
}
+ }
- void OnDisplayKindPropertiesChanged()
+ void OnDisplayKindPropertiesChanged()
+ {
+ Control thisAsControl = this;
+ if (Value >= 0)
{
- Control thisAsControl = this;
- if (Value >= 0)
- {
- VisualStateManager.GoToState(thisAsControl, "Value", true);
- }
- else if (IconSource is { } iconSource)
+ VisualStateManager.GoToState(thisAsControl, "Value", true);
+ }
+ else if (IconSource is { } iconSource)
+ {
+ TemplateSettings.IconElement = iconSource.CreateIconElement();
+ if (iconSource is FontIconSource)
{
- TemplateSettings.IconElement = iconSource.CreateIconElement();
- if (iconSource is FontIconSource)
- {
- VisualStateManager.GoToState(thisAsControl, "FontIcon", true);
- }
- else
- {
- VisualStateManager.GoToState(thisAsControl, "Icon", true);
- }
+ VisualStateManager.GoToState(thisAsControl, "FontIcon", true);
}
else
{
- VisualStateManager.GoToState(thisAsControl, "Dot", true);
+ VisualStateManager.GoToState(thisAsControl, "Icon", true);
}
}
+ else
+ {
+ VisualStateManager.GoToState(thisAsControl, "Dot", true);
+ }
+ }
- private void OnSizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs args)
+ private void OnSizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs args)
+ {
+ CornerRadius GetCornerRadius()
{
- CornerRadius GetCornerRadius()
+ var cornerRadiusValue = ActualHeight / 2;
+ if (ReadLocalValue(CornerRadiusProperty) == DependencyProperty.UnsetValue)
{
- var cornerRadiusValue = ActualHeight / 2;
- if (SharedHelpers.IsRS5OrHigher())
- {
- if (ReadLocalValue(CornerRadiusProperty) == DependencyProperty.UnsetValue)
- {
- return new CornerRadius(cornerRadiusValue, cornerRadiusValue, cornerRadiusValue, cornerRadiusValue);
- }
- else
- {
- return new CornerRadius();
- }
- }
return new CornerRadius(cornerRadiusValue, cornerRadiusValue, cornerRadiusValue, cornerRadiusValue);
}
+ else
+ {
+ return new CornerRadius();
+ }
+ //return new CornerRadius(cornerRadiusValue, cornerRadiusValue, cornerRadiusValue, cornerRadiusValue);
+ }
- var value = GetCornerRadius();
+ var value = GetCornerRadius();
- TemplateSettings.InfoBadgeCornerRadius = value;
- }
+ TemplateSettings.InfoBadgeCornerRadius = value;
}
}
diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.properties.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.properties.cs
index 6068c388eb8d..21687279e4ed 100644
--- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.properties.cs
+++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.properties.cs
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
-// MUX reference InfoBadge.properties.cpp, commit 76bd573
+// MUX reference InfoBadge.properties.cpp, tag winui3/release/1.4.2
using System;
using System.Collections.Generic;
@@ -9,43 +9,61 @@
using System.Threading.Tasks;
using Windows.UI.Xaml;
-namespace Microsoft.UI.Xaml.Controls
+namespace Microsoft.UI.Xaml.Controls;
+
+public partial class InfoBadge
{
- public partial class InfoBadge
+ ///
+ /// Gets or sets the integer to be displayed in a numeric InfoBadge.
+ ///
+ public int Value
+ {
+ get => (int)GetValue(ValueProperty);
+ set => SetValue(ValueProperty, value);
+ }
+
+ ///
+ /// Identifies the InfoBadge.Value dependency property.
+ ///
+ public static DependencyProperty ValueProperty { get; } =
+ DependencyProperty.Register(nameof(Value), typeof(int), typeof(InfoBadge), new FrameworkPropertyMetadata(-1, OnPropertyChanged));
+
+ ///
+ /// Provides calculated values that can be referenced as TemplatedParent sources when defining
+ /// templates for an InfoBadge. Not intended for general use.
+ ///
+ public InfoBadgeTemplateSettings TemplateSettings
+ {
+ get => (InfoBadgeTemplateSettings)GetValue(TemplateSettingsProperty);
+ private set => SetValue(TemplateSettingsProperty, value);
+ }
+
+ ///
+ /// Identifies the InfoBadgeTemplateSettings dependency property.
+ ///
+ public static DependencyProperty TemplateSettingsProperty { get; } =
+ DependencyProperty.Register(nameof(TemplateSettings), typeof(InfoBadgeTemplateSettings), typeof(InfoBadge), new FrameworkPropertyMetadata(null, OnPropertyChanged));
+
+ ///
+ /// Gets or sets the icon to be used in an InfoBadge.
+ ///
+ public IconSource IconSource
+ {
+ get => (IconSource)GetValue(IconSourceProperty);
+ set => SetValue(IconSourceProperty, value);
+ }
+
+ ///
+ /// Identifies the InfoBadge.IconSource dependency property.
+ ///
+ public static DependencyProperty IconSourceProperty { get; } =
+ DependencyProperty.Register(nameof(IconSource), typeof(IconSource), typeof(InfoBadge), new FrameworkPropertyMetadata(null, OnPropertyChanged));
+
+ private static void OnPropertyChanged(
+ DependencyObject sender,
+ DependencyPropertyChangedEventArgs args)
{
- public int Value
- {
- get => (int)GetValue(ValueProperty);
- set => SetValue(ValueProperty, value);
- }
-
- public static DependencyProperty ValueProperty { get; } =
- DependencyProperty.Register(nameof(Value), typeof(int), typeof(InfoBadge), new FrameworkPropertyMetadata(-1, OnPropertyChanged));
-
- public InfoBadgeTemplateSettings TemplateSettings
- {
- get => (InfoBadgeTemplateSettings)GetValue(TemplateSettingsProperty);
- set => SetValue(TemplateSettingsProperty, value);
- }
-
- public static DependencyProperty TemplateSettingsProperty { get; } =
- DependencyProperty.Register(nameof(TemplateSettings), typeof(InfoBadgeTemplateSettings), typeof(InfoBadge), new FrameworkPropertyMetadata(null, OnPropertyChanged));
-
- public IconSource IconSource
- {
- get => (IconSource)GetValue(IconSourceProperty);
- set => SetValue(IconSourceProperty, value);
- }
-
- public static DependencyProperty IconSourceProperty { get; } =
- DependencyProperty.Register(nameof(IconSource), typeof(IconSource), typeof(InfoBadge), new FrameworkPropertyMetadata(null, OnPropertyChanged));
-
- private static void OnPropertyChanged(
- DependencyObject sender,
- DependencyPropertyChangedEventArgs args)
- {
- var owner = (InfoBadge)sender;
- owner.OnPropertyChanged(args);
- }
+ var owner = (InfoBadge)sender;
+ owner.OnPropertyChanged(args);
}
}
diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.xaml b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.xaml
index 400dbdf59c81..5f00e8825a06 100644
--- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.xaml
+++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge.xaml
@@ -1,9 +1,5 @@
-
-
-
-
+
+
+
diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadgeTemplateSettings.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadgeTemplateSettings.cs
index 3903ca1229db..91b24a5d2099 100644
--- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadgeTemplateSettings.cs
+++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadgeTemplateSettings.cs
@@ -1,34 +1,51 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
-// MUX reference InfoBadgeTemplateSettings.properties.cpp, commit 76bd573
+// MUX reference InfoBadgeTemplateSettings.properties.cpp, tag winui3/release/1.4.2
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
-namespace Microsoft.UI.Xaml.Controls
+namespace Microsoft.UI.Xaml.Controls;
+
+///
+/// Provides calculated values that can be referenced as TemplatedParent sources when defining templates for an InfoBadge.
+///
+public partial class InfoBadgeTemplateSettings : DependencyObject
{
- public partial class InfoBadgeTemplateSettings : DependencyObject
+ ///
+ /// Initializes a new instance of the InfoBadgeTemplateSettings class.
+ ///
+ public InfoBadgeTemplateSettings()
{
- public InfoBadgeTemplateSettings()
- {
- }
-
- public IconElement IconElement
- {
- get => (IconElement)GetValue(IconElementProperty);
- set => SetValue(IconElementProperty, value);
- }
+ }
- public static DependencyProperty IconElementProperty { get; } =
- DependencyProperty.Register(nameof(IconElement), typeof(IconElement), typeof(InfoBadgeTemplateSettings), new FrameworkPropertyMetadata(null));
+ ///
+ /// Gets or sets the icon element for an InfoBadge.
+ ///
+ public IconElement IconElement
+ {
+ get => (IconElement)GetValue(IconElementProperty);
+ set => SetValue(IconElementProperty, value);
+ }
- public CornerRadius InfoBadgeCornerRadius
- {
- get => (CornerRadius)GetValue(InfoBadgeCornerRadiusProperty);
- set => SetValue(InfoBadgeCornerRadiusProperty, value);
- }
+ ///
+ /// Identifies the InfoBadgeTemplateSettings.IconElement dependency property.
+ ///
+ public static DependencyProperty IconElementProperty { get; } =
+ DependencyProperty.Register(nameof(IconElement), typeof(IconElement), typeof(InfoBadgeTemplateSettings), new FrameworkPropertyMetadata(null));
- public static DependencyProperty InfoBadgeCornerRadiusProperty { get; } =
- DependencyProperty.Register(nameof(InfoBadgeCornerRadius), typeof(CornerRadius), typeof(InfoBadgeTemplateSettings), new FrameworkPropertyMetadata(default(CornerRadius)));
+ ///
+ /// Gets or sets the corner radius for an InfoBadge.
+ ///
+ public CornerRadius InfoBadgeCornerRadius
+ {
+ get => (CornerRadius)GetValue(InfoBadgeCornerRadiusProperty);
+ set => SetValue(InfoBadgeCornerRadiusProperty, value);
}
+
+ ///
+ /// Identifies the InfoBadgeTemplateSettings.InfoBadgeCornerRadius dependency property.
+ ///
+ public static DependencyProperty InfoBadgeCornerRadiusProperty { get; } =
+ DependencyProperty.Register(nameof(InfoBadgeCornerRadius), typeof(CornerRadius), typeof(InfoBadgeTemplateSettings), new FrameworkPropertyMetadata(default(CornerRadius)));
}
diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge_themeresources.xaml b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge_themeresources.xaml
index 88cf3bea99e5..3d426f1f6e3f 100644
--- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge_themeresources.xaml
+++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBadge/InfoBadge_themeresources.xaml
@@ -1,184 +1,149 @@
-
-
-
-
-
-
-
-
- 4
- 4
- 16
- 11
- 8
- 12
- 0,0,0,0
- 4,0,4,2
- 4,0,4,2
- 4,4,4,4
-
-
-
-
-
- 4
- 4
- 16
- 11
- 9
- 12
- 0,0,0,0
- 4,0,4,2
- 4,0,4,2
- 4,4,4,4
-
-
-
-
-
- 4
- 4
- 16
- 11
- 9
- 12
- 0,0,0,0
- 4,0,4,2
- 4,0,4,2
- 4,4,4,4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+