protected internal override ItemAutomationPeer FindOrCreateItemAutomationPeer(object item) { ItemAutomationPeer itemAutomationPeer = base.ItemPeers[item]; AutomationPeer peer = this; if (base.EventsSource is TreeViewDataItemAutomationPeer) { peer = (base.EventsSource as TreeViewDataItemAutomationPeer); } if (itemAutomationPeer == null) { itemAutomationPeer = base.GetPeerFromWeakRefStorage(item); } if (itemAutomationPeer == null) { itemAutomationPeer = this.CreateItemAutomationPeer(item); if (itemAutomationPeer != null) { itemAutomationPeer.TrySetParentInfo(peer); } } if (itemAutomationPeer != null) { AutomationPeer wrapperPeer = itemAutomationPeer.GetWrapperPeer(); if (wrapperPeer != null) { wrapperPeer.EventsSource = itemAutomationPeer; } } return(itemAutomationPeer); }
protected virtual internal ItemAutomationPeer FindOrCreateItemAutomationPeer(object item) { ItemAutomationPeer peer = ItemPeers[item]; if (peer == null) { peer = GetPeerFromWeakRefStorage(item); } if (peer == null) { peer = CreateItemAutomationPeer(item); if (peer != null) { peer.TrySetParentInfo(this); } } if (peer != null) { //perform hookup so the events sourced from wrapper peer are fired as if from the data item AutomationPeer wrapperPeer = peer.GetWrapperPeer(); if (wrapperPeer != null) { wrapperPeer.EventsSource = peer; } } return(peer); }
protected internal virtual ItemAutomationPeer FindOrCreateItemAutomationPeer(object item) { ItemAutomationPeer itemAutomationPeer = this.ItemPeers[item]; if (itemAutomationPeer == null) { itemAutomationPeer = this.GetPeerFromWeakRefStorage(item); } if (itemAutomationPeer == null) { itemAutomationPeer = this.CreateItemAutomationPeer(item); if (itemAutomationPeer != null) { itemAutomationPeer.TrySetParentInfo(this); } } if (itemAutomationPeer != null) { AutomationPeer wrapperPeer = itemAutomationPeer.GetWrapperPeer(); if (wrapperPeer != null) { wrapperPeer.EventsSource = itemAutomationPeer; } } return(itemAutomationPeer); }
/// <summary> /// It returns the ItemAutomationPeer if it exist corresponding to the item otherwise it creates /// one and does add the Handle and parent info by calling TrySetParentInfo. /// </summary> /// <param name="item"></param> /// <returns></returns> protected override internal ItemAutomationPeer FindOrCreateItemAutomationPeer(object item) { ItemAutomationPeer peer = ItemPeers[item]; AutomationPeer parentPeer = this; if (EventsSource as TreeViewDataItemAutomationPeer != null) { parentPeer = EventsSource as TreeViewDataItemAutomationPeer; } if (peer == null) { peer = GetPeerFromWeakRefStorage(item); } if (peer == null) { peer = CreateItemAutomationPeer(item); if (peer != null) { peer.TrySetParentInfo(parentPeer); } } if (peer != null) { AutomationPeer wrapperPeer = (peer as ItemAutomationPeer).GetWrapperPeer(); if (wrapperPeer != null) { wrapperPeer.EventsSource = peer; } } return(peer); }