/// <summary> /// Enable accesibility /// </summary> /// <typeparam name="TView"></typeparam> /// <param name="view"></param> /// <param name="name"></param> /// <param name="helpText"></param> /// <param name="attributtedEnums"></param> /// <param name="isTabStop"></param> /// <param name="tabIndex"></param> /// <returns></returns> public static TView EnableAccessibility <TView>(this TView view, string name, string helpText, FieldAccessibilityType attributtedEnums = FieldAccessibilityType.None, bool?isTabStop = true, int?tabIndex = null) where TView : View { AutomationProperties.SetIsInAccessibleTree(view, true); AutomationProperties.SetName(view, name); AutomationProperties.SetHelpText(view, helpText); if (isTabStop.HasValue) { view.IsTabStop = isTabStop.Value; } if (tabIndex.HasValue) { view.TabIndex = tabIndex.Value; } #if __IOS__ if (attributtedEnums != FieldAccessibilityType.None) { var renderer = view.GetOrCreateRenderer(); if (renderer != null) { var nativeView = renderer.NativeView; var aeString = attributtedEnums.ToString(); var traitEnum = ParseEnum <UIAccessibilityTrait>(aeString); nativeView.AccessibilityTraits = traitEnum; } } #endif return(view); }
public static ToolBarButton NewToolbarButton(IEntityOperationContext eoc) { var man = OperationClient.Manager; ToolBarButton button = new ToolBarButton { Content = man.GetText(eoc.OperationInfo.OperationSymbol, eoc.OperationSettings), Image = man.GetImage(eoc.OperationInfo.OperationSymbol, eoc.OperationSettings), Tag = eoc.OperationInfo, Background = man.GetBackground(eoc.OperationInfo, eoc.OperationSettings) }; if (eoc.OperationSettings != null && eoc.OperationSettings.Order != 0) { Common.SetOrder(button, eoc.OperationSettings.Order); } AutomationProperties.SetName(button, eoc.OperationInfo.OperationSymbol.Key); eoc.SenderButton = button; if (eoc.CanExecute != null) { button.ToolTip = eoc.CanExecute; button.IsEnabled = false; ToolTipService.SetShowOnDisabled(button, true); AutomationProperties.SetHelpText(button, eoc.CanExecute); } else { button.Click += (_, __) => OperationExecute(eoc); } return(button); }
public CustomContent(int idx) { AutomationProperties.SetIsInAccessibleTree(this, false); IsTabStop = false; Frame.IsTabStop = true; Frame.TabIndex = idx; var stack = new StackLayout(); var label = new Label() { Text = idx.ToString() }; Frame.Content = label; stack.Children.Add(Frame); AutomationProperties.SetHelpText(Frame, idx.ToString()); AutomationProperties.SetIsInAccessibleTree(label, false); AutomationProperties.SetIsInAccessibleTree(Frame, true); AutomationProperties.SetIsInAccessibleTree(stack, false); Content = stack; }
public IDisposable DoingWork(string work) { lock (workLock) { IsWorking = true; loadingMessages.Add(work); WorkingText = work; var view = (DependencyObject)GetView(); AutomationProperties.SetHelpText(view, "Busy"); return(new DelegateDisposable(() => { lock (workLock) { loadingMessages.Remove(work); if (loadingMessages.Count > 0) { IsWorking = true; WorkingText = loadingMessages.Last(); } else { IsWorking = false; WorkingText = null; AutomationProperties.SetHelpText(view, string.Empty); } } })); } }
public SettingsPage(Settings settings) { InitializeComponent(); this.settings = settings; // Barker: I couldn't get LabeledBy to work with a Checkbox. AutomationProperties.SetName( ShowSuggestionsButtonCheckBox, "Show the TalkBack suggestions button."); AutomationProperties.SetName( TurnOverOneCardCheckBox, "Turn over remaining cards one at a time."); AutomationProperties.SetName( IncludeRowNumberCheckBox, "Include the row number in the dealt card TalkBack announcement."); AutomationProperties.SetHelpText( IncludeRowNumberCheckBox, "Takes effect after the next game restart."); AutomationProperties.SetName( HideUICheckBox, "Hide all the visuals in the game."); ShowSuggestionsButtonCheckBox.IsChecked = this.settings.ShowSuggestionsButton; TurnOverOneCardCheckBox.IsChecked = this.settings.TurnOverOneCard; IncludeRowNumberCheckBox.IsChecked = this.settings.IncludeRowNumber; HideUICheckBox.IsChecked = Settings.HideUI; }
public MainPageCS() { var label = new Label { Text = "This is a label!", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; // Might have to add Internet permissions to Android project // ...Settings->Application-Permissions, in order to show the image var image = new Image { Source = "https://alexdunndev.files.wordpress.com/2017/02/xamarintips.png", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; var button = new Button { Text = "This is a button!", BorderWidth = 0.5, WidthRequest = 300, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; // Accessibility changes AutomationProperties.SetHelpText(image, "Images"); AutomationProperties.SetName(image, "Light bulb"); AutomationProperties.SetIsInAccessibleTree(button, true); Content = new StackLayout { Children = { label, image, button } }; }
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 PrepareContainerForItemOverride(DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); var resourceLoader = ResourceLoader.GetForCurrentView(); AutomationProperties.SetHelpText( element, resourceLoader.GetString("BirdItemHelp")); }
/// <summary> /// Accessibility extension /// https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/accessibility/ /// </summary> /// <typeparam name="TView"></typeparam> /// <param name="view"></param> /// <param name="name"></param> /// <param name="helpText"></param> /// <param name="isTabStop"></param> /// <param name="tabIndex"></param> /// <returns></returns> public static TView SetAccessibility <TView>(this TView view, string name, string helpText, bool isTabStop = true, int?tabIndex = null) where TView : View { AutomationProperties.SetIsInAccessibleTree(view, true); AutomationProperties.SetName(view, name); AutomationProperties.SetHelpText(view, helpText); view.IsTabStop = isTabStop; if (tabIndex.HasValue) { view.TabIndex = tabIndex.Value; } return(view); }
#pragma warning disable CA1801 // Review unused parameters private void ShortcutDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) #pragma warning restore CA1801 // Review unused parameters { if (ComboIsValid(lastValidSettings)) { HotkeySettings = lastValidSettings.Clone(); } PreviewKeysControl.ItemsSource = hotkeySettings.GetKeysList(); AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString()); shortcutDialog.Hide(); }
/// <summary> // Correctly handle programmatically selected items // This updates the floating buttons /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSelected(object sender, RoutedEventArgs e) { var tvi = sender as TreeViewItem; var vm = tvi.DataContext as HierarchyNodeViewModel; if (vm != null) { btnMenu.DataContext = vm; if (vm.Element.IsRootElement()) { btnMenu.Visibility = Visibility.Collapsed; btnTestElement.Visibility = Visibility.Collapsed; } else if (this.IsLiveMode) { btnMenu.Visibility = Visibility.Visible; btnTestElement.Visibility = Visibility.Visible; var hlptxt = string.Format(CultureInfo.InvariantCulture, Properties.Resources.HierarchyControl_LiveMode_InvokeToTestFormat, vm.Element.Glimpse); AutomationProperties.SetHelpText(btnTestElement, hlptxt); } else { btnMenu.Visibility = Visibility.Visible; btnTestElement.Visibility = Visibility.Collapsed; } tvi.BringIntoView(); Dispatcher.BeginInvoke(new Action(() => { try { GeneralTransform myTransform = tvi.TransformToAncestor(treeviewHierarchy); System.Windows.Point p = myTransform.Transform(new System.Windows.Point(0, 0)); btnTestElement.Height = TreeButtonHeight; btnTestElement.Margin = new Thickness(0, p.Y, btnTestElement.Margin.Right, 0); btnMenu.Height = TreeButtonHeight; btnMenu.Margin = new Thickness(0, p.Y, btnMenu.Margin.Right, 0); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) { ex.ReportException(); } #pragma warning restore CA1031 // Do not catch general exception types })); } e.Handled = true; }
public static void UpdateSemantics(this FrameworkElement platformView, IView view) { var semantics = view.Semantics; if (semantics == null) { return; } AutomationProperties.SetName(platformView, semantics.Description); AutomationProperties.SetHelpText(platformView, semantics.Hint); AutomationProperties.SetHeadingLevel(platformView, (UI.Xaml.Automation.Peers.AutomationHeadingLevel)((int)semantics.HeadingLevel)); }
protected override void Init() { var instructions = new Label { Text = "Manual check that both Label 1 have the same size, if the 1st is bigger than this test failed." }; var label = new Label { Text = "Label 1", BackgroundColor = Color.Red }; AutomationProperties.SetHelpText(label, "The longer this label hit is, the worse the problem"); var image = new Image { Source = "bank.png", BackgroundColor = Color.Red }; AutomationProperties.SetHelpText(image, "The longer this image hint is, the worse the problem"); var image2 = new Image { Source = "bank.png", BackgroundColor = Color.Red }; var label2 = new Label { Text = "Label 1", BackgroundColor = Color.Red }; var horizontalLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { label, image, new Label { Text = "label 2" }, new Label { Text = "label 3" }, new Label { Text = "label 4" } } }; Content = new StackLayout { Children = { instructions, horizontalLayout, new StackLayout { Orientation = StackOrientation.Horizontal,Children = { label2, image2, new Label { Text = "label 2" }, new Label { Text = "label 3" }, new Label { Text = "label 4" } } } } }; }
public static MenuItem Construct(IContextualOperationContext coc) { MenuItem miResult = new MenuItem { Header = OperationClient.GetText(coc.Type, coc.OperationInfo.OperationSymbol), Icon = OperationClient.GetImage(coc.Type, coc.OperationInfo.OperationSymbol).ToSmallImage(), Tag = coc, }; if (coc.OperationSettings != null && coc.OperationSettings.Order != 0) { Common.SetOrder(miResult, coc.OperationSettings.Order); } if (coc.CanExecute != null) { miResult.ToolTip = coc.CanExecute; miResult.IsEnabled = false; ToolTipService.SetShowOnDisabled(miResult, true); AutomationProperties.SetHelpText(miResult, coc.CanExecute); } miResult.Click += (object sender, RoutedEventArgs e) => { coc.SearchControl.SetDirtySelectedItems(); if (coc.OperationSettings != null && coc.OperationSettings.HasClick) { coc.OperationSettings.OnClick(coc); } else { if (coc.ConfirmMessage()) { Entity result = (Entity) new ConstructorContext(coc.SearchControl, coc.OperationInfo).SurroundConstructUntyped(coc.OperationInfo.ReturnType, ctx => Server.Return((IOperationServer s) => s.ConstructFromMany(coc.SearchControl.SelectedItems.ToList(), coc.Type, coc.OperationInfo.OperationSymbol, ctx.Args))); if (result != null) { Navigator.Navigate(result); } else { MessageBox.Show(Window.GetWindow(coc.SearchControl), OperationMessage.TheOperation0DidNotReturnAnEntity.NiceToString().FormatWith(coc.OperationInfo.OperationSymbol.NiceToString())); } } } }; return(miResult); }
/// <summary> // Correctly handle programmatically selected items // This updates the floating buttons /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSelected(object sender, RoutedEventArgs e) { var tvi = sender as TreeViewItem; var vm = tvi.DataContext as HierarchyNodeViewModel; if (vm != null) { btnMenu.DataContext = vm; if (vm.Element.IsRootElement()) { btnMenu.Visibility = Visibility.Collapsed; btnTestElement.Visibility = Visibility.Collapsed; } else if (this.IsLiveMode) { btnMenu.Visibility = Visibility.Visible; btnTestElement.Visibility = Visibility.Visible; var hlptxt = string.Format(CultureInfo.InvariantCulture, "Invoke to test {0} and descendants", vm.Element.Glimpse); AutomationProperties.SetHelpText(btnTestElement, hlptxt); } else { btnMenu.Visibility = Visibility.Visible; btnTestElement.Visibility = Visibility.Collapsed; } tvi.BringIntoView(); Dispatcher.BeginInvoke(new Action(() => { try { GeneralTransform myTransform = tvi.TransformToAncestor(treeviewHierarchy); System.Windows.Point p = myTransform.Transform(new System.Windows.Point(0, 0)); btnTestElement.Height = TreeButtonHeight; btnTestElement.Margin = new Thickness(0, p.Y, btnTestElement.Margin.Right, 0); btnMenu.Height = TreeButtonHeight; btnMenu.Margin = new Thickness(0, p.Y, btnMenu.Margin.Right, 0); } catch (Exception) { // ignore without tracking it. } })); } e.Handled = true; }
// Token: 0x06002D20 RID: 11552 RVA: 0x000CBC14 File Offset: 0x000C9E14 private Image GetImage() { Image image = null; Uri uri = this._object as Uri; if (uri != null) { image = new Image(); image.Source = new BitmapImage(uri); image.Width = image.Source.Width; image.Height = image.Source.Height; AutomationProperties.SetName(image, (string)base.GetValue(FixedElement.NameProperty)); AutomationProperties.SetHelpText(image, (string)base.GetValue(FixedElement.HelpTextProperty)); } return(image); }
private Image GetImage() { Image image = null; // return value Uri source = _object as Uri; if (source != null) { image = new Image(); image.Source = new System.Windows.Media.Imaging.BitmapImage(source); image.Width = image.Source.Width; image.Height = image.Source.Height; AutomationProperties.SetName(image, (String)this.GetValue(NameProperty)); AutomationProperties.SetHelpText(image, (String)this.GetValue(HelpTextProperty)); } return(image); }
/// <summary> /// In some cases (just Popovers currently) we need to wait to set the automation properties until the element /// that needs them comes into existence (a PopoverRoot in the case of a Popover, when it's shown). This is /// used for that delayed initialization. /// </summary> /// <param name="element">UIElement on which to set the properties</param> public void InitAutomationProperties(UIElement element) { if (identifier != null) { AutomationProperties.SetAutomationId(element, identifier); } if (label != null) { AutomationProperties.SetName(element, label); } if (description != null) { AutomationProperties.SetHelpText(element, description); } if (labelWidget != null) { AutomationProperties.SetLabeledBy(element, (Toolkit.GetBackend(labelWidget) as WidgetBackend)?.Widget); } }
public MainPage() { InitializeComponent(); accessibilityNameService = DependencyService.Get <IAccessibilityName>(DependencyFetchTarget.NewInstance); b1 = new Button { Text = "I HAVE AN ACCESSIBILITY DESCRIPTION", BackgroundColor = Color.Green, }; AutomationProperties.SetName(b1, "This is my accessibility name"); AutomationProperties.SetHelpText(b1, "And this is my accessibility help text"); stacklayout.Children.Add(b1); b2 = new Button { Text = "USELESS BUTTON WITH NO DESCRIPTION", BackgroundColor = Color.Green, }; stacklayout.Children.Add(b2); l1 = new Label { BackgroundColor = Color.Orange, WidthRequest = 100, HeightRequest = 100, }; AutomationProperties.SetIsInAccessibleTree(l1, true); AutomationProperties.SetName(l1, "Accessibility name should not be visible"); AutomationProperties.SetHelpText(l1, "Neither accessibility help text should not be visible"); stacklayout.Children.Add(l1); l2 = new Label { BackgroundColor = Color.Orange, WidthRequest = 100, HeightRequest = 100, }; AutomationProperties.SetIsInAccessibleTree(l2, true); stacklayout.Children.Add(l2); }
public void draw1Node(int x, int y, string nameVertex) { Ellipse ellipse = new Ellipse(); ellipse.MinHeight = 50; ellipse.MinWidth = 90; ellipse.HorizontalAlignment = HorizontalAlignment.Center; AutomationProperties.SetHelpText(ellipse, "0"); setColorGuiNode(ellipse, Brushes.DarkGray, new SolidColorBrush(Color.FromRgb(79, 79, 79)), 0.75, 3); Grid grid = new Grid(); grid.Tag = ellipse; grid.ToolTip = nameVertex; Panel.SetZIndex(grid, 2); Canvas.SetLeft(grid, x); Canvas.SetTop(grid, y); grid.HorizontalAlignment = HorizontalAlignment.Left; grid.MouseLeftButtonDown += shape_MouseLeftButtonDown; grid.MouseRightButtonDown += shape_MouseRightButtonDown; grid.MouseEnter += Grid_MouseEnter; grid.MouseLeave += Grid_MouseLeave; grid.MouseMove += shape_MouseMove; grid.MouseLeftButtonUp += shape_MouseLeftButtonUp; TextBlock textBlock = new TextBlock(); textBlock.Text = nameVertex; textBlock.Foreground = Brushes.White; textBlock.FontSize = 14; textBlock.HorizontalAlignment = HorizontalAlignment.Center; textBlock.VerticalAlignment = VerticalAlignment.Center; grid.Children.Add(ellipse); grid.Children.Add(textBlock); mainWindow.canvas.Children.Add(grid); vertNameToGrid[nameVertex] = grid; }
public static MenuItem Construct(IContextualOperationContext coc) { MenuItem miResult = new MenuItem { Header = coc.OperationSettings?.Text ?? coc.OperationInfo.OperationSymbol.NiceToString(), Icon = coc.OperationSettings?.Icon.ToSmallImage(), Tag = coc, }; if (coc.CanExecute != null) { miResult.ToolTip = coc.CanExecute; miResult.IsEnabled = false; ToolTipService.SetShowOnDisabled(miResult, true); AutomationProperties.SetHelpText(miResult, coc.CanExecute); } coc.SenderMenuItem = miResult; miResult.Click += (object sender, RoutedEventArgs e) => { coc.SearchControl.SetDirtySelectedItems(); if (coc.OperationSettings != null && coc.OperationSettings.HasClick) { coc.OperationSettings.OnClick(coc); } else { if (coc.ConfirmMessage()) { IEntity entity = Server.Return((IProcessServer s) => s.CreatePackageOperation(coc.Entities.ToList(), coc.OperationInfo.OperationSymbol)); Navigator.Navigate(entity); } } }; return(miResult); }
static MenuItem GetMenuItem(QuickLink ql) { var mi = new MenuItem { DataContext = ql, Header = ql.Label, Icon = ql.Icon.ToSmallImage(), } .Set(AutomationProperties.NameProperty, ql.Name) .Bind(MenuItem.HeaderProperty, "Label"); if (ql.ToolTip.HasText()) { mi.ToolTip = ql.ToolTip; ToolTipService.SetShowOnDisabled(mi, true); AutomationProperties.SetHelpText(mi, ql.ToolTip); } mi.Click += (sender, args) => ql.Execute(); return(mi); }
void AddView(StackLayout layout, View view, string labelPrefix, string automationId, string buttonName = null, string buttonHelp = null) { var automationIdLabel = new Label(); automationIdLabel.Text = $"AutomationId = {automationId}"; automationIdLabel.AutomationId = $"{labelPrefix}-automationIdLabel"; var contentDescriptionLabel = new Label(); contentDescriptionLabel.AutomationId = $"{labelPrefix}-contentDescriptionLabel"; var nameAndHelpTextLabel = new Label(); nameAndHelpTextLabel.AutomationId = $"{labelPrefix}-nameAndHelpTextLabel"; view.AutomationId = automationId; view.Effects.Add(new ContentDescriptionEffect()); view.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { if (e.PropertyName == ContentDescriptionEffectProperties.ContentDescriptionProperty.PropertyName) { contentDescriptionLabel.Text = $"ContentDescription = {ContentDescriptionEffectProperties.GetContentDescription(view)}"; } if (e.PropertyName == ContentDescriptionEffectProperties.NameAndHelpTextProperty.PropertyName) { nameAndHelpTextLabel.Text = $"Name + HelpText = {ContentDescriptionEffectProperties.GetNameAndHelpText(view)}"; } }; layout.Children.Add(view); layout.Children.Add(automationIdLabel); layout.Children.Add(contentDescriptionLabel); layout.Children.Add(nameAndHelpTextLabel); AutomationProperties.SetIsInAccessibleTree(view, true); AutomationProperties.SetName(view, buttonName); AutomationProperties.SetHelpText(view, buttonHelp); }
private void UpdateHeaderAutomationProperties(GridViewColumnHeader columnHeader) { var sortDir = SortableColumnHeaderAttachedProperties.GetSortDirectionProperty(columnHeader); string oldHelpText = AutomationProperties.GetHelpText(columnHeader); string newHelpText; if (sortDir == ListSortDirection.Ascending) { newHelpText = Resx.Resources.Accessibility_ColumnSortedAscendingHelpText; } else if (sortDir == ListSortDirection.Descending) { newHelpText = Resx.Resources.Accessibility_ColumnSortedDescendingHelpText; } else { newHelpText = Resx.Resources.Accessibility_ColumnNotSortedHelpText; } AutomationProperties.SetHelpText(columnHeader, newHelpText); var peer = UIElementAutomationPeer.FromElement(columnHeader); peer?.RaisePropertyChangedEvent(AutomationElementIdentifiers.HelpTextProperty, oldHelpText, newHelpText); }
internal static MenuItem NewMenuItem(IEntityOperationContext eoc, EntityOperationGroup group) { var man = OperationClient.Manager; MenuItem menuItem = new MenuItem { Header = eoc.OperationSettings?.Text ?? (group == null || group.SimplifyName == null ? eoc.OperationInfo.OperationSymbol.NiceToString() : group.SimplifyName(eoc.OperationInfo.OperationSymbol.NiceToString())), Icon = man.GetImage(eoc.OperationInfo.OperationSymbol, eoc.OperationSettings).ToSmallImage(), Tag = eoc.OperationInfo, Background = man.GetBackground(eoc.OperationInfo, eoc.OperationSettings) }; if (eoc.OperationSettings != null && eoc.OperationSettings.Order != 0) { Common.SetOrder(menuItem, eoc.OperationSettings.Order); } AutomationProperties.SetName(menuItem, eoc.OperationInfo.OperationSymbol.Key); eoc.SenderButton = menuItem; if (eoc.CanExecute != null) { menuItem.ToolTip = eoc.CanExecute; menuItem.IsEnabled = false; ToolTipService.SetShowOnDisabled(menuItem, true); AutomationProperties.SetHelpText(menuItem, eoc.CanExecute); } else { menuItem.Click += (_, __) => OperationExecute(eoc); } return(menuItem); }
// TODO: Instead of using hardcoded text for accessibility items, use a RESX file (same as you would for multiple languages) private void SetAccessibilityValues() { AutomationProperties.SetIsInAccessibleTree(textLabel, false); AutomationProperties.SetName(textLabel, "Text Label"); AutomationProperties.SetIsInAccessibleTree(textEntry, true); AutomationProperties.SetLabeledBy(textEntry, textLabel); // Redundant / Excess verbiage AutomationProperties.SetHelpText(textEntry, "My Text Entry"); AutomationProperties.SetIsInAccessibleTree(descriptionLabel, false); AutomationProperties.SetIsInAccessibleTree(descriptionEditor, true); AutomationProperties.SetLabeledBy(descriptionEditor, descriptionLabel); // Redundant / Excess verbiage AutomationProperties.SetHelpText(descriptionEditor, "My Description Editor"); AutomationProperties.SetIsInAccessibleTree(cancelButton, true); AutomationProperties.SetName(cancelButton, "Cancel"); AutomationProperties.SetIsInAccessibleTree(saveButton, true); AutomationProperties.SetName(saveButton, "Save"); if (Device.RuntimePlatform == Device.iOS) { AutomationProperties.SetHelpText(cancelButton, "Activate to cancel add new item."); AutomationProperties.SetHelpText(saveButton, "Activate to save new item."); } // TODO: Can also use data binding to set these values. set to values and remember to RaiseProperty changed when needed. //cancelButton.SetBinding(AutomationProperties.NameProperty, nameof(NewItem2ViewModel.CancelAutomationName)); //cancelButton.SetBinding(AutomationProperties.HelpTextProperty, nameof(NewItem2ViewModel.CancelAutomationHelptext)); //cancelButton.SetBinding(AutomationProperties.IsInAccessibleTreeProperty, nameof(NewItem2ViewModel.CancelIsInTree)); }
private void btAddToWishList_Clicked(object sender, System.EventArgs e) { imWishList.Source = ImageSource.FromFile("monkey.png"); AutomationProperties.SetHelpText(imCart, "Lista de deseos con un elemento"); accessibilityService.PlayAudio("Mono añadido a la lista de deseos"); }
void OnButtonClicked(object sender, EventArgs e) { activityIndicator.IsRunning = !activityIndicator.IsRunning; AutomationProperties.SetHelpText(activityIndicator, activityIndicator.IsRunning ? "Running" : "Not running"); }
static void OnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { AutomationProperties.SetHelpText(d, GetIsApplicationBusy(d) ? "Busy" : string.Empty); }
private void TransformStage(string msg, int secs, string colorhex, BitmapImage iconsrc) { SolidColorBrush bg = new SolidColorBrush(); bg = (SolidColorBrush)(new BrushConverter().ConvertFrom(colorhex)); Grid grdParent; switch (_Theme) { case ThemeType.Standard: spStandard.Visibility = System.Windows.Visibility.Visible; spOutline.Visibility = System.Windows.Visibility.Collapsed; grdParent = FindVisualChildren <Grid>(spStandard).FirstOrDefault(); grdParent.Background = bg; break; case ThemeType.Outline: default: spStandard.Visibility = System.Windows.Visibility.Collapsed; spOutline.Visibility = System.Windows.Visibility.Visible; grdParent = FindVisualChildren <Grid>(spOutline).FirstOrDefault(); bdr.BorderBrush = bg; break; } TextBlock lblMessage = FindVisualChildren <TextBlock>(grdParent).FirstOrDefault(); List <Image> imgs = FindVisualChildren <Image>(grdParent).ToList(); Image imgStatusIcon = imgs[0]; Image imgCloseIcon = imgs[1]; if (_IconVisibility == false) { imgStatusIcon.Visibility = System.Windows.Visibility.Collapsed; grdParent.ColumnDefinitions.RemoveAt(0); lblMessage.SetValue(Grid.ColumnProperty, 0); imgCloseIcon.SetValue(Grid.ColumnProperty, 1); lblMessage.Margin = new Thickness(10, 4, 0, 4); lblMessage.Height = 16; } else { imgStatusIcon.Source = iconsrc; } lblMessage.Text = msg; grdWrapper.Visibility = System.Windows.Visibility.Visible; key1.KeyTime = new TimeSpan(0, 0, (secs <= 0 ? 0 : secs - 1)); key2.KeyTime = new TimeSpan(0, 0, secs); RaiseShowEvent(); if (AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged)) { if (barText != msg) { barText = msg; AutomationProperties.SetHelpText(this, barText); var peer = UIElementAutomationPeer.FromElement(this); if (peer == null) { peer = UIElementAutomationPeer.CreatePeerForElement(this); } peer.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged); //peer.RaiseAutomationEvent(AutomationEvents.TextPatternOnTextChanged); } } }