}
}
+ protected override void SetAccessibilityLabel()
+ {
+ // If we have not specified an AccessibilityLabel and the AccessibiltyLabel is current bound to the Title,
+ // exit this method so we don't set the AccessibilityLabel value and break the binding.
+ // This may pose a problem for users who want to explicitly set the AccessibilityLabel to null, but this
+ // will prevent us from inadvertently breaking UI Tests that are using Query.Marked to get the dynamic Title
+ // of the Button.
+
+ var elemValue = (string)Element?.GetValue(Accessibility.NameProperty);
+ if (string.IsNullOrWhiteSpace(elemValue) && Control?.AccessibilityLabel == Control?.Title(UIControlState.Normal))
+ return;
+
+ base.SetAccessibilityLabel();
+ }
+
void OnButtonTouchUpInside(object sender, EventArgs eventArgs)
{
((IButtonController)Element)?.SendReleased();
Control.AccessibilityLabel = (string)Element.GetValue(Accessibility.NameProperty) ?? _defaultAccessibilityLabel;
}
+#if __MOBILE__
+ protected override void SetAccessibilityHint()
+ {
+ if (Control == null)
+ {
+ base.SetAccessibilityHint();
+ return;
+ }
+
+ if (Element == null)
+ return;
+
+ if (_defaultAccessibilityHint == null)
+ _defaultAccessibilityHint = Control.AccessibilityHint;
+
+ Control.AccessibilityHint = (string)Element.GetValue(Accessibility.HintProperty) ?? _defaultAccessibilityHint;
+
+ }
+
+ protected override void SetAccessibilityLabel()
+ {
+ if (Control == null)
+ {
+ base.SetAccessibilityLabel();
+ return;
+ }
+
+ if (Element == null)
+ return;
+
+ if (_defaultAccessibilityLabel == null)
+ _defaultAccessibilityLabel = Control.AccessibilityLabel;
+
+ Control.AccessibilityLabel = (string)Element.GetValue(Accessibility.NameProperty) ?? _defaultAccessibilityLabel;
+ }
+
+ protected override void SetIsAccessibilityElement()
+ {
+ if (Control == null)
+ {
+ base.SetIsAccessibilityElement();
+ return;
+ }
protected override void SetIsAccessibilityElement()
{