diff --git a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/TextExamples.xaml b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/TextExamples.xaml index 9bfac4b50b..c555c141ec 100644 --- a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/TextExamples.xaml +++ b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/TextExamples.xaml @@ -376,7 +376,8 @@ - diff --git a/src/MahApps.Metro/Automation/Peers/NumericUpdDownAutomationPeer.cs b/src/MahApps.Metro/Automation/Peers/NumericUpdDownAutomationPeer.cs new file mode 100644 index 0000000000..98be8bf237 --- /dev/null +++ b/src/MahApps.Metro/Automation/Peers/NumericUpdDownAutomationPeer.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Windows.Automation.Peers; +using JetBrains.Annotations; +using MahApps.Metro.Controls; + +namespace MahApps.Metro.Automation.Peers +{ + public class NumericUpdDownAutomationPeer : FrameworkElementAutomationPeer + { + public NumericUpdDownAutomationPeer([NotNull] NumericUpDown owner) + : base(owner) + { + } + + protected override string GetClassNameCore() + { + return nameof(NumericUpDown); + } + + protected override AutomationControlType GetAutomationControlTypeCore() + { + return AutomationControlType.Edit; + } + } +} \ No newline at end of file diff --git a/src/MahApps.Metro/Controls/NumericUpDown.cs b/src/MahApps.Metro/Controls/NumericUpDown.cs index 41edb0d2db..9eb740746c 100644 --- a/src/MahApps.Metro/Controls/NumericUpDown.cs +++ b/src/MahApps.Metro/Controls/NumericUpDown.cs @@ -16,6 +16,8 @@ using System.Windows.Input; using JetBrains.Annotations; using MahApps.Metro.ValueBoxes; +using MahApps.Metro.Automation.Peers; +using System.Windows.Automation.Peers; namespace MahApps.Metro.Controls { @@ -1019,6 +1021,14 @@ public override void OnApplyTemplate() this.scrollViewer = null; } + /// + /// Creates AutomationPeer () + /// + protected override AutomationPeer OnCreateAutomationPeer() + { + return new NumericUpdDownAutomationPeer(this); + } + private void ToggleReadOnlyMode(bool isReadOnly) { if (this.repeatUp is null || this.repeatDown is null || this.valueTextBox is null)