diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2020-02-10 11:33:20 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2020-02-10 13:32:38 +0300 |
commit | 3e9f6584839fa70b0f82f8efb919ebcb1084cd98 (patch) | |
tree | 25194f4f9309e87050b4befee2196587cb34e7b3 /Xwt | |
parent | 451bd31435046873b92dd65010522dae0d83faf1 (diff) |
Add Accessible.PropertyChanged event
to allow custom widgets to customize accessibility behaviour
Diffstat (limited to 'Xwt')
-rw-r--r-- | Xwt/Xwt.Accessibility/Accessible.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Xwt/Xwt.Accessibility/Accessible.cs b/Xwt/Xwt.Accessibility/Accessible.cs index 4456d8e6..b9626a40 100644 --- a/Xwt/Xwt.Accessibility/Accessible.cs +++ b/Xwt/Xwt.Accessibility/Accessible.cs @@ -25,7 +25,9 @@ // THE SOFTWARE. using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; +using System.Runtime.CompilerServices; using Xwt.Backends; namespace Xwt.Accessibility @@ -130,6 +132,7 @@ namespace Xwt.Accessibility } set { Backend.IsAccessible = value; + OnPropertyChanged(); } } @@ -139,6 +142,7 @@ namespace Xwt.Accessibility } set { Backend.Identifier = value; + OnPropertyChanged(); } } @@ -148,6 +152,7 @@ namespace Xwt.Accessibility } set { Backend.Label = value; + OnPropertyChanged(); } } @@ -156,6 +161,7 @@ namespace Xwt.Accessibility set { labelWidget = value; Backend.LabelWidget = value; + OnPropertyChanged(); } } @@ -165,6 +171,7 @@ namespace Xwt.Accessibility } set { Backend.Title = value; + OnPropertyChanged(); } } @@ -174,6 +181,7 @@ namespace Xwt.Accessibility } set { Backend.Description = value; + OnPropertyChanged(); } } @@ -183,6 +191,7 @@ namespace Xwt.Accessibility } set { Backend.Value = value; + OnPropertyChanged(); } } @@ -192,6 +201,7 @@ namespace Xwt.Accessibility } set { Backend.Uri = value; + OnPropertyChanged(); } } @@ -201,6 +211,7 @@ namespace Xwt.Accessibility } set { Backend.Bounds = value; + OnPropertyChanged(); } } @@ -210,6 +221,7 @@ namespace Xwt.Accessibility } set { Backend.Role = value; + OnPropertyChanged(); } } @@ -219,6 +231,7 @@ namespace Xwt.Accessibility } set { Backend.RoleDescription = value; + OnPropertyChanged (); } } @@ -261,6 +274,16 @@ namespace Xwt.Accessibility } } + void OnPropertyChanged ([CallerMemberName] string propertyName = null) + { + if (propertyName != null) + { + PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (propertyName)); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + /// <param name="polite">(WPF, XamMac, GtkMac) will use AutomationLiveSetting.Polite/NSAccessibilityPriorityLevel.Medium /// if true and AutomationLiveSetting.Assertive/NSAccessibilityPriorityLevel.High otherwise (default)</param> public void MakeAnnouncement (string message, bool polite = false) |