diff --git a/ModernWpf.Controls/DropDownButton/DropDownButtonAutomationPeer.cs b/ModernWpf.Controls/DropDownButton/DropDownButtonAutomationPeer.cs
index f55669d5..845943a6 100644
--- a/ModernWpf.Controls/DropDownButton/DropDownButtonAutomationPeer.cs
+++ b/ModernWpf.Controls/DropDownButton/DropDownButtonAutomationPeer.cs
@@ -26,7 +26,7 @@ public override object GetPattern(PatternInterface patternInterface)
protected override string GetClassNameCore()
{
- return typeof(DropDownButton).FullName;
+ return nameof(DropDownButton);
}
private DropDownButton GetImpl()
diff --git a/ModernWpf.Controls/NumberBox/NumberBoxAutomationPeer.cs b/ModernWpf.Controls/NumberBox/NumberBoxAutomationPeer.cs
index cc8df736..451657b9 100644
--- a/ModernWpf.Controls/NumberBox/NumberBoxAutomationPeer.cs
+++ b/ModernWpf.Controls/NumberBox/NumberBoxAutomationPeer.cs
@@ -26,7 +26,7 @@ public override object GetPattern(PatternInterface patternInterface)
protected override string GetClassNameCore()
{
- return typeof(NumberBox).FullName;
+ return nameof(NumberBox);
}
protected override string GetNameCore()
diff --git a/ModernWpf.Controls/PersonPicture/PersonPictureAutomationPeer.cs b/ModernWpf.Controls/PersonPicture/PersonPictureAutomationPeer.cs
index 72c67673..9bc104c2 100644
--- a/ModernWpf.Controls/PersonPicture/PersonPictureAutomationPeer.cs
+++ b/ModernWpf.Controls/PersonPicture/PersonPictureAutomationPeer.cs
@@ -19,7 +19,7 @@ protected override AutomationControlType GetAutomationControlTypeCore()
protected override string GetClassNameCore()
{
- return typeof(PersonPicture).FullName;
+ return nameof(PersonPicture);
}
}
}
diff --git a/ModernWpf.Controls/ProgressRing/ProgressRing.cs b/ModernWpf.Controls/ProgressRing/ProgressRing.cs
index c92f310f..54c468af 100644
--- a/ModernWpf.Controls/ProgressRing/ProgressRing.cs
+++ b/ModernWpf.Controls/ProgressRing/ProgressRing.cs
@@ -1,7 +1,9 @@
-using ModernWpf.Controls.Primitives;
-using System;
+using System;
using System.Windows;
+using System.Windows.Automation.Peers;
using System.Windows.Controls;
+using ModernWpf.Automation.Peers;
+using ModernWpf.Controls.Primitives;
namespace ModernWpf.Controls
{
@@ -21,8 +23,7 @@ public class ProgressRing : Control
static ProgressRing()
{
- DefaultStyleKeyProperty.OverrideMetadata(typeof(ProgressRing),
- new FrameworkPropertyMetadata(typeof(ProgressRing)));
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ProgressRing), new FrameworkPropertyMetadata(typeof(ProgressRing)));
}
public ProgressRing()
@@ -30,6 +31,11 @@ public ProgressRing()
TemplateSettings = new ProgressRingTemplateSettings();
}
+ protected override AutomationPeer OnCreateAutomationPeer()
+ {
+ return new ProgressRingAutomationPeer(this);
+ }
+
#region IsActive
public bool IsActive
@@ -47,7 +53,7 @@ public bool IsActive
private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- ((ProgressRing)d).UpdateVisualStates(true);
+ ((ProgressRing)d).ChangeVisualState(true);
}
#endregion
@@ -58,7 +64,7 @@ public override void OnApplyTemplate()
{
base.OnApplyTemplate();
- UpdateVisualStates(false);
+ ChangeVisualState(false);
}
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
@@ -77,10 +83,10 @@ protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
templateSettings.EllipseOffset = new Thickness(0, maxSideLength / 2 - ellipseDiameter, 0, 0);
templateSettings.MaxSideLength = maxSideLength;
- UpdateVisualStates(true);
+ ChangeVisualState(true);
}
- private void UpdateVisualStates(bool useTransitions)
+ private void ChangeVisualState(bool useTransitions)
{
VisualStateManager.GoToState(this, IsActive ? ActiveState : InactiveState, useTransitions);
VisualStateManager.GoToState(this, TemplateSettings.MaxSideLength < 60 ? SmallState : LargeState, useTransitions);
diff --git a/ModernWpf.Controls/ProgressRing/ProgressRing.xaml b/ModernWpf.Controls/ProgressRing/ProgressRing.xaml
index 7df7441a..76129b94 100644
--- a/ModernWpf.Controls/ProgressRing/ProgressRing.xaml
+++ b/ModernWpf.Controls/ProgressRing/ProgressRing.xaml
@@ -13,7 +13,7 @@
-
+
diff --git a/ModernWpf.Controls/ProgressRing/ProgressRingAutomationPeer.cs b/ModernWpf.Controls/ProgressRing/ProgressRingAutomationPeer.cs
new file mode 100644
index 00000000..afab10aa
--- /dev/null
+++ b/ModernWpf.Controls/ProgressRing/ProgressRingAutomationPeer.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+using System.Windows.Automation.Peers;
+using ModernWpf.Controls;
+
+namespace ModernWpf.Automation.Peers
+{
+ public class ProgressRingAutomationPeer : FrameworkElementAutomationPeer
+ {
+ public ProgressRingAutomationPeer(ProgressRing owner) : base(owner)
+ {
+ }
+
+ protected override string GetClassNameCore()
+ {
+ return nameof(ProgressRing);
+ }
+
+ protected override string GetNameCore()
+ {
+ string name = base.GetNameCore();
+
+ if (Owner is ProgressRing progressRing)
+ {
+ if (progressRing.IsActive)
+ {
+ return Strings.ProgressRingIndeterminateStatus + name;
+ }
+ }
+ return name;
+ }
+
+ protected override AutomationControlType GetAutomationControlTypeCore()
+ {
+ return AutomationControlType.ProgressBar;
+ }
+ }
+}
diff --git a/ModernWpf.Controls/SplitButton/SplitButtonAutomationPeer.cs b/ModernWpf.Controls/SplitButton/SplitButtonAutomationPeer.cs
index 4660aea1..ded0d75b 100644
--- a/ModernWpf.Controls/SplitButton/SplitButtonAutomationPeer.cs
+++ b/ModernWpf.Controls/SplitButton/SplitButtonAutomationPeer.cs
@@ -29,7 +29,7 @@ public override object GetPattern(PatternInterface patternInterface)
protected override string GetClassNameCore()
{
- return typeof(SplitButton).FullName;
+ return nameof(SplitButton);
}
protected override AutomationControlType GetAutomationControlTypeCore()
diff --git a/ModernWpf.Controls/SplitButton/ToggleSplitButtonAutomationPeer.cs b/ModernWpf.Controls/SplitButton/ToggleSplitButtonAutomationPeer.cs
index 14ab4451..bfc8c482 100644
--- a/ModernWpf.Controls/SplitButton/ToggleSplitButtonAutomationPeer.cs
+++ b/ModernWpf.Controls/SplitButton/ToggleSplitButtonAutomationPeer.cs
@@ -29,7 +29,7 @@ public override object GetPattern(PatternInterface patternInterface)
protected override string GetClassNameCore()
{
- return typeof(ToggleSplitButton).FullName;
+ return nameof(ToggleSplitButton);
}
protected override AutomationControlType GetAutomationControlTypeCore()
diff --git a/ModernWpf/ProgressBar/ProgressBarAutomationPeer.cs b/ModernWpf/ProgressBar/ProgressBarAutomationPeer.cs
index a0b5ce1a..606b7771 100644
--- a/ModernWpf/ProgressBar/ProgressBarAutomationPeer.cs
+++ b/ModernWpf/ProgressBar/ProgressBarAutomationPeer.cs
@@ -40,7 +40,7 @@ public override object GetPattern(PatternInterface patternInterface)
protected override string GetClassNameCore()
{
- return typeof(ProgressBar).FullName;
+ return nameof(ProgressBar);
}
protected override string GetNameCore()
diff --git a/ModernWpf/Resources/Strings.Designer.cs b/ModernWpf/Resources/Strings.Designer.cs
index a00c1ace..d917a69a 100644
--- a/ModernWpf/Resources/Strings.Designer.cs
+++ b/ModernWpf/Resources/Strings.Designer.cs
@@ -276,6 +276,15 @@ internal class Strings {
}
}
+ ///
+ /// Looks up a localized string similar to Busy.
+ ///
+ internal static string ProgressRingIndeterminateStatus {
+ get {
+ return ResourceManager.GetString("ProgressRingIndeterminateStatus", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Proofing.
///
diff --git a/ModernWpf/Resources/Strings.resx b/ModernWpf/Resources/Strings.resx
index 1c8d8d48..7830a550 100644
--- a/ModernWpf/Resources/Strings.resx
+++ b/ModernWpf/Resources/Strings.resx
@@ -269,4 +269,8 @@
Paused
This is used to announce Paused state.
+
+ Busy
+ This is used to announce Indeterminate state.
+
\ No newline at end of file