diff --git a/Flex.Android/CustomRenderers/GestureFrameRenderer.cs b/Flex.Android/CustomRenderers/GestureFrameRenderer.cs
index 01ec11e..614e0c8 100644
--- a/Flex.Android/CustomRenderers/GestureFrameRenderer.cs
+++ b/Flex.Android/CustomRenderers/GestureFrameRenderer.cs
@@ -6,6 +6,8 @@
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Flex.Controls;
+using AndroidView = Android.Views;
+using Android.Views.Accessibility;
[assembly: ExportRenderer(typeof(GestureFrame), typeof(GestureFrameRenderer))]
namespace Flex.Android.CustomRenderers
@@ -14,6 +16,17 @@ public class GestureFrameRenderer : Xamarin.Forms.Platform.Android.AppCompat.Fra
{
public GestureFrameRenderer(Context context) : base(context)
{
+ SetAccessibilityDelegate(new GestureFrameRendererAccessibilityDelegate());
+ }
+
+ private class GestureFrameRendererAccessibilityDelegate : AccessibilityDelegate
+ {
+ public override void OnInitializeAccessibilityNodeInfo(AndroidView.View host, AccessibilityNodeInfo info)
+ {
+ base.OnInitializeAccessibilityNodeInfo(host, info);
+ info.ClassName = "android.widget.Button";
+ info.Clickable = true;
+ }
}
protected override void OnElementChanged(ElementChangedEventArgs e)
diff --git a/Flex.Demo.iOS/Flex.Demo.iOS.csproj b/Flex.Demo.iOS/Flex.Demo.iOS.csproj
index a8aa67f..452c48e 100644
--- a/Flex.Demo.iOS/Flex.Demo.iOS.csproj
+++ b/Flex.Demo.iOS/Flex.Demo.iOS.csproj
@@ -135,6 +135,8 @@
{43DD689A-3918-43EB-B654-8E1C54F23C72}
Flex.iOS
+ false
+ false
{4FBE2794-BD54-4C5E-B95A-46B2D5606C5F}
@@ -153,7 +155,6 @@
-
diff --git a/Flex.Demo/Flex.Demo.csproj b/Flex.Demo/Flex.Demo.csproj
index c7c8cf3..004aa9e 100644
--- a/Flex.Demo/Flex.Demo.csproj
+++ b/Flex.Demo/Flex.Demo.csproj
@@ -9,10 +9,4 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Flex.Demo/FlexDemoPage.xaml b/Flex.Demo/FlexDemoPage.xaml
index 07fa8bb..929b6ff 100644
--- a/Flex.Demo/FlexDemoPage.xaml
+++ b/Flex.Demo/FlexDemoPage.xaml
@@ -54,6 +54,7 @@
IconPadding="0"
CornerRadius="38"
Icon="lightbulb.png"
+ AccessibleName="Light bulb"
ForegroundColor="#ffffff"
HighlightForegroundColor="#49516F"
BackgroundColor="#6279B8"
@@ -72,7 +73,7 @@
- e)
{
base.OnElementChanged(e);
+ AccessibilityTraits = UIAccessibilityTrait.Button;
+
if (e.OldElement == null)
{
// Fix Xamarin.Forms Frame BackgroundColor Bug (https://github.com/xamarin/Xamarin.Forms/issues/2218)
diff --git a/Flex/Controls/FlexButton.xaml.cs b/Flex/Controls/FlexButton.xaml.cs
index 8562052..ceca3ab 100644
--- a/Flex/Controls/FlexButton.xaml.cs
+++ b/Flex/Controls/FlexButton.xaml.cs
@@ -178,6 +178,14 @@ public bool HasShadow
set => SetValue(HasShadowProperty, value);
}
+ public static readonly BindableProperty AccessibleNameProperty = BindableProperty.Create(nameof(AccessibleName), typeof(string), typeof(FlexButton), null);
+ public string AccessibleName
+ {
+ get => (string)GetValue(AccessibleNameProperty);
+ set => SetValue(AccessibleNameProperty, value);
+ }
+
+
#endregion
#region Commands
@@ -249,7 +257,6 @@ protected override void OnBindingContextChanged()
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
- var test = 0f;
if (propertyName == PaddingProperty.PropertyName)
{
userChangedPadding = true;
@@ -358,6 +365,9 @@ void SetButtonMode()
mode = ButtonMode.TextOnly;
}
+ // Set Accessibility Name
+ AutomationProperties.SetName(Border, AccessibleName ?? Text);
+
if (ButtonIcon == null || ButtonText == null)
return;
diff --git a/Nuget/Forms.Controls.FlexButton.nuspec b/Nuget/Forms.Controls.FlexButton.nuspec
index 180f2d3..94bc531 100644
--- a/Nuget/Forms.Controls.FlexButton.nuspec
+++ b/Nuget/Forms.Controls.FlexButton.nuspec
@@ -2,7 +2,7 @@
Forms.Controls.FlexButton
- 0.13.0
+ 0.14.0
FlexButton for Xamarin.Forms
Robin-Manuel Thiel
Robin-Manuel Thiel
@@ -12,7 +12,7 @@
images/Logo-150.png
Flexible button control for Xamarin.Forms
Flexible button control for Xamarin.Forms
- Update to Xamarin.Forms 4.8
+ Add Accessiblity Options
flex xamarin.forms control button flexbutton xamarin flexible pill
diff --git a/README.md b/README.md
index a4184a4..6d4c643 100644
--- a/README.md
+++ b/README.md
@@ -80,6 +80,7 @@ Take a look a the [Demo Project](/Flex.Demo) in this repository for a full sampl
| `IconTintEnabled` | `true` | Enables tinting of the icon (Set to false, if your icon is colorized) |
| `HasShadow` | `false` | Enables Xamarin.Forms Frame's Shadow around the button |
| `MaxLines` | `1` | Maximum number of lines for test. Set it to `-1` for flexible amount of lines |
+| `AccessibleName` | `string.Empty` | Accessibility Name for Automation |
| Event | Description |
|------------------|---------|