public SettingBlockAutomationPeer([NotNull] TextBlock owner) : base(owner) { this.textBlockAutomationPeer = new TextBlockAutomationPeer(owner); }
public AutomationDelegatingListViewItemAutomationPeer(AutomationDelegatingListViewItem listViewItem) : base(listViewItem) { checkBoxItem = this.GetChildren().OfType<CheckBoxAutomationPeer>().SingleOrDefault(); if (checkBoxItem != null) { var toggleButton = ((CheckBox)checkBoxItem.Owner); toggleButton.Checked += Checkbox_CheckChanged; toggleButton.Unchecked += Checkbox_CheckChanged; return; } radioButtonItem = this.GetChildren().OfType<RadioButtonAutomationPeer>().SingleOrDefault(); if (radioButtonItem != null) { var toggleButton = ((RadioButton)radioButtonItem.Owner); toggleButton.Checked += RadioButton_CheckChanged; toggleButton.Unchecked += RadioButton_CheckChanged; return; } textBlockItem = this.GetChildren().OfType<TextBlockAutomationPeer>().FirstOrDefault(); }
/// <summary> /// Gets the <see cref="AutomationPeer"/>s from the <see cref="DataFormAutomationPeer"/>. /// </summary> private void GetChildAutomationPeers() { this._firstItemButtonAutomationPeer = null; this._previousItemButtonAutomationPeer = null; this._nextItemButtonAutomationPeer = null; this._lastItemButtonAutomationPeer = null; this._editButtonAutomationPeer = null; this._newItemButtonAutomationPeer = null; this._deleteItemButtonAutomationPeer = null; this._commitButtonAutomationPeer = null; this._cancelButtonAutomationPeer = null; this._labelAutomationPeers = new List<TextBlockAutomationPeer>(); this._inputControlAutomationPeers = new List<AutomationPeer>(); this._descriptionAutomationPeers = new List<DescriptionViewerAutomationPeer>(); List<AutomationPeer> automationPeers = this._dataFormAutomationPeer.GetChildren(); foreach (AutomationPeer automationPeer in automationPeers) { string className = automationPeer.GetClassName(); if (className == "Button") { ButtonAutomationPeer buttonAutomationPeer = automationPeer as ButtonAutomationPeer; Assert.IsNotNull(buttonAutomationPeer); string automationId = automationPeer.GetAutomationId(); switch (automationId) { case "FirstItemButton": this._firstItemButtonAutomationPeer = buttonAutomationPeer; break; case "PreviousItemButton": this._previousItemButtonAutomationPeer = buttonAutomationPeer; break; case "NextItemButton": this._nextItemButtonAutomationPeer = buttonAutomationPeer; break; case "LastItemButton": this._lastItemButtonAutomationPeer = buttonAutomationPeer; break; case "EditButton": this._editButtonAutomationPeer = buttonAutomationPeer; break; case "NewItemButton": this._newItemButtonAutomationPeer = buttonAutomationPeer; break; case "DeleteItemButton": this._deleteItemButtonAutomationPeer = buttonAutomationPeer; break; case "CommitButton": this._commitButtonAutomationPeer = buttonAutomationPeer; break; case "CancelButton": this._cancelButtonAutomationPeer = buttonAutomationPeer; break; default: Assert.Fail("Unexpected ButtonAutomationPeer."); break; } } else if (className == "TextBlock") { this._changeIndicatorAutomationPeer = automationPeer as TextBlockAutomationPeer; } else if (className == "ScrollViewer") { this._scrollViewerAutomationPeer = automationPeer as ScrollViewerAutomationPeer; Assert.IsNotNull(this._scrollViewerAutomationPeer); List<AutomationPeer> formAutomationPeers = this._scrollViewerAutomationPeer.GetChildren(); for (int i = 0; i < formAutomationPeers.Count; i++) { if (i % 3 == 0) { TextBlockAutomationPeer textBlockAutomationPeer = formAutomationPeers[i] as TextBlockAutomationPeer; if (textBlockAutomationPeer != null) { this._labelAutomationPeers.Add(textBlockAutomationPeer); } } else if (i % 3 == 1) { this._inputControlAutomationPeers.Add(formAutomationPeers[i]); } else { DescriptionViewerAutomationPeer descriptionViewerAutomationPeer = formAutomationPeers[i] as DescriptionViewerAutomationPeer; if (descriptionViewerAutomationPeer != null) { this._descriptionAutomationPeers.Add(descriptionViewerAutomationPeer); } } } } } }