protected override void Update(global::Android.Views.View view, SemanticEffectRouter effect) { var isHeading = SemanticEffect.GetHeadingLevel(Element) != CommunityToolkit.Effects.Semantic.HeadingLevel.None; ViewCompat.SetAccessibilityHeading(view, isHeading); var desc = SemanticEffect.GetDescription(Element); var hint = SemanticEffect.GetHint(Element); if (!string.IsNullOrEmpty(hint) || !string.IsNullOrEmpty(desc)) { if (semanticAccessibilityDelegate == null) { semanticAccessibilityDelegate = new SemanticAccessibilityDelegate(Element); ViewCompat.SetAccessibilityDelegate(view, semanticAccessibilityDelegate); } } else if (semanticAccessibilityDelegate != null) { semanticAccessibilityDelegate = null; ViewCompat.SetAccessibilityDelegate(view, null); } if (semanticAccessibilityDelegate != null) { semanticAccessibilityDelegate.Element = Element; view.ImportantForAccessibility = global::Android.Views.ImportantForAccessibility.Yes; } }
protected override void Update(UIView view, SemanticEffectRouter effect) { var isHeading = SemanticEffect.GetHeadingLevel(Element) != CommunityToolkit.Effects.Semantic.HeadingLevel.None; if (isHeading) { view.AccessibilityTraits |= UIAccessibilityTrait.Header; } else { view.AccessibilityTraits &= ~UIAccessibilityTrait.Header; } var desc = SemanticEffect.GetDescription(Element); var hint = SemanticEffect.GetHint(Element); view.AccessibilityLabel = desc; view.AccessibilityHint = hint; // UIControl elements automatically have IsAccessibilityElement set to true if (view is not UIControl && (!string.IsNullOrWhiteSpace(hint) || !string.IsNullOrWhiteSpace(desc))) { view.IsAccessibilityElement = true; } }
protected override void Update(FrameworkElement view, SemanticEffectRouter effect) { var headingLevel = (AutomationHeadingLevel)((int)SemanticEffect.GetHeadingLevel(Element)); AutomationProperties.SetHeadingLevel(view, headingLevel); AutomationProperties.SetName(view, SemanticEffect.GetDescription(Element) ?? string.Empty); AutomationProperties.SetHelpText(view, SemanticEffect.GetHint(Element) ?? string.Empty); }
protected override void Update(global::Android.Views.View view, SemanticEffectRouter effect) { var isHeading = SemanticEffect.GetHeadingLevel(Element) != CommunityToolkit.Effects.Semantic.HeadingLevel.None; ViewCompat.SetAccessibilityHeading(view, isHeading); var a11yVisibility = SemanticEffect.GetSemanticInclusion(Element); switch (a11yVisibility) { case SemanticInclusion.Default: ViewCompat.SetImportantForAccessibility(view, ViewCompat.ImportantForAccessibilityAuto); break; case SemanticInclusion.Include: ViewCompat.SetImportantForAccessibility(view, ViewCompat.ImportantForAccessibilityYes); break; case SemanticInclusion.Exclude: ViewCompat.SetImportantForAccessibility(view, ViewCompat.ImportantForAccessibilityNo); break; case SemanticInclusion.ExcludeWithChildren: ViewCompat.SetImportantForAccessibility(view, ViewCompat.ImportantForAccessibilityNoHideDescendants); break; } var desc = SemanticEffect.GetDescription(Element); var hint = SemanticEffect.GetHint(Element); if (!string.IsNullOrWhiteSpace(hint) || !string.IsNullOrWhiteSpace(desc)) { if (semanticAccessibilityDelegate == null) { semanticAccessibilityDelegate = new SemanticAccessibilityDelegate(Element); ViewCompat.SetAccessibilityDelegate(view, semanticAccessibilityDelegate); } } else if (semanticAccessibilityDelegate != null) { semanticAccessibilityDelegate = null; ViewCompat.SetAccessibilityDelegate(view, null); } if (semanticAccessibilityDelegate != null) { semanticAccessibilityDelegate.Element = Element; view.ImportantForAccessibility = global::Android.Views.ImportantForAccessibility.Yes; } }
protected override void Update(UIView view, SemanticEffectRouter effect) { var isHeading = SemanticEffect.GetHeadingLevel(Element) != CommunityToolkit.Effects.Semantic.HeadingLevel.None; if (isHeading) { view.AccessibilityTraits |= UIAccessibilityTrait.Header; } else { view.AccessibilityTraits &= ~UIAccessibilityTrait.Header; } var semanticInclusion = SemanticEffect.GetSemanticInclusion(Element); switch (semanticInclusion) { case SemanticInclusion.Default: view.IsAccessibilityElement = view is UIControl; view.AccessibilityElementsHidden = false; break; case SemanticInclusion.Include: view.IsAccessibilityElement = true; view.AccessibilityElementsHidden = false; break; case SemanticInclusion.Exclude: view.IsAccessibilityElement = false; view.AccessibilityElementsHidden = false; break; case SemanticInclusion.ExcludeWithChildren: view.IsAccessibilityElement = false; view.AccessibilityElementsHidden = true; break; } var desc = SemanticEffect.GetDescription(Element); var hint = SemanticEffect.GetHint(Element); view.AccessibilityLabel = desc; view.AccessibilityHint = hint; // UIControl elements automatically have IsAccessibilityElement set to true if (view is not UIControl && (!string.IsNullOrWhiteSpace(hint) || !string.IsNullOrWhiteSpace(desc))) { view.IsAccessibilityElement = true; } }