public override void GetName_AttachedProperty0Event() { if (!EventsManager.Instance.AutomationSingletonExists) { return; } DataGridColumnHeader columnHeader = CreateConcreteFrameworkElement() as DataGridColumnHeader; AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(columnHeader); AutomationPropertyEventTuple tuple = null; EventsManager.Instance.Reset(); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.NameProperty); Assert.IsNull(tuple, "#0"); EventsManager.Instance.Reset(); columnHeader.SetValue(AutomationProperties.NameProperty, "Attached Name"); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.NameProperty); Assert.IsNull(tuple, "#1"); EventsManager.Instance.Reset(); columnHeader.SetValue(AutomationProperties.NameProperty, "Name"); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.NameProperty); Assert.IsNull(tuple, "#2"); EventsManager.Instance.Reset(); columnHeader.SetValue(AutomationProperties.NameProperty, null); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.NameProperty); Assert.IsNull(tuple, "#3"); }
public override void GetName_AttachedProperty1() { DataGridColumnHeader element = CreateConcreteFrameworkElement() as DataGridColumnHeader; AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(element); string textblockName = "Hello world:"; string nameProperty = "TextBox name"; TextBlock textblock = new TextBlock(); textblock.Text = textblockName; element.SetValue(AutomationProperties.NameProperty, nameProperty); Assert.AreEqual(element.Content, peer.GetName(), "GetName #0"); element.SetValue(AutomationProperties.LabeledByProperty, textblock); Assert.AreEqual(textblockName, peer.GetName(), "GetName #1"); textblock.Text = null; Assert.AreEqual(string.Empty, peer.GetName(), "GetName #2"); textblock.Text = string.Empty; Assert.AreEqual(string.Empty, peer.GetName(), "GetName #3"); element.SetValue(AutomationProperties.NameProperty, null); Assert.AreEqual(string.Empty, peer.GetName(), "GetName #4"); element.SetValue(AutomationProperties.LabeledByProperty, null); Assert.AreEqual(element.Content, peer.GetName(), "GetName #5"); }
public override void GetName_AttachedProperty0() { DataGridColumnHeader fe = CreateConcreteFrameworkElement() as DataGridColumnHeader; AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(fe); Assert.AreEqual(fe.Content, peer.GetName(), "GetName"); string name = "Attached Name"; fe.SetValue(AutomationProperties.NameProperty, name); Assert.AreEqual(fe.Content, peer.GetName(), "GetName #1"); fe.SetValue(AutomationProperties.NameProperty, null); Assert.AreEqual(fe.Content, peer.GetName(), "GetName #2"); }
public static void SetIsLastVisibleColumnHeader(DataGridColumnHeader columnHeader, bool value) { columnHeader.SetValue(IsLastVisibleColumnHeaderProperty, value); }
public static void SetComputedSeparatorVisibility(DataGridColumnHeader header, Visibility value) { header.SetValue(ComputedSeparatorVisibilityProperty, value); }
public static void SetIsEnabled(DataGridColumnHeader header, bool value) { header.SetValue(IsEnabledProperty, value); }
public override void GetName_AttachedProperty1Event() { if (!EventsManager.Instance.AutomationSingletonExists) { return; } DataGridColumnHeader columnHeader = CreateConcreteFrameworkElement() as DataGridColumnHeader; AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(columnHeader); AutomationPropertyEventTuple tuple = null; TextBlock textblock = new TextBlock() { Text = "Hello world:" }; AutomationPeer textblockPeer = FrameworkElementAutomationPeer.CreatePeerForElement(textblock); EventsManager.Instance.Reset(); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.NameProperty); Assert.IsNull(tuple, "#0"); EventsManager.Instance.Reset(); columnHeader.SetValue(AutomationProperties.NameProperty, "My name"); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.NameProperty); Assert.IsNull(tuple, "#1"); EventsManager.Instance.Reset(); columnHeader.SetValue(AutomationProperties.LabeledByProperty, textblock); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.NameProperty); Assert.IsNotNull(tuple, "#2"); Assert.AreEqual("Hello world:", (string)tuple.NewValue, "#5"); Assert.AreEqual(columnHeader.Content, (string)tuple.OldValue, "#6"); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.LabeledByProperty); Assert.IsNotNull(tuple, "#7"); Assert.AreEqual(textblock, tuple.NewValue, "#8"); Assert.AreEqual(null, tuple.OldValue, "#9"); EventsManager.Instance.Reset(); textblock.Text = null; tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.NameProperty); Assert.IsNotNull(tuple, "#10"); Assert.AreEqual(string.Empty, (string)tuple.NewValue, "#11"); Assert.AreEqual("Hello world:", (string)tuple.OldValue, "#12"); tuple = EventsManager.Instance.GetAutomationEventFrom(textblockPeer, AutomationElementIdentifiers.NameProperty); Assert.IsNotNull(tuple, "#13"); Assert.AreEqual(string.Empty, (string)tuple.NewValue, "#14"); Assert.AreEqual("Hello world:", (string)tuple.OldValue, "#15"); EventsManager.Instance.Reset(); columnHeader.SetValue(AutomationProperties.LabeledByProperty, null); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.NameProperty); Assert.IsNotNull(tuple, "#16"); Assert.AreEqual(columnHeader.Content, (string)tuple.NewValue, "#17"); Assert.AreEqual(string.Empty, (string)tuple.OldValue, "#18"); tuple = EventsManager.Instance.GetAutomationEventFrom(peer, AutomationElementIdentifiers.LabeledByProperty); Assert.IsNotNull(tuple, "#19"); Assert.AreEqual(null, tuple.NewValue, "#20"); Assert.AreEqual(textblock, tuple.OldValue, "#21"); }