// Token: 0x060058F7 RID: 22775 RVA: 0x00189CAC File Offset: 0x00187EAC private static void OnIsExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TreeViewItem treeViewItem = (TreeViewItem)d; bool flag = (bool)e.NewValue; TreeView parentTreeView = treeViewItem.ParentTreeView; if (parentTreeView != null && !flag) { parentTreeView.HandleSelectionAndCollapsed(treeViewItem); } ItemsPresenter itemsHostPresenter = treeViewItem.ItemsHostPresenter; if (itemsHostPresenter != null) { treeViewItem.InvalidateMeasure(); Helper.InvalidateMeasureOnPath(itemsHostPresenter, treeViewItem, false); } TreeViewItemAutomationPeer treeViewItemAutomationPeer = UIElementAutomationPeer.FromElement(treeViewItem) as TreeViewItemAutomationPeer; if (treeViewItemAutomationPeer != null) { treeViewItemAutomationPeer.RaiseExpandCollapseAutomationEvent((bool)e.OldValue, flag); } if (flag) { treeViewItem.OnExpanded(new RoutedEventArgs(TreeViewItem.ExpandedEvent, treeViewItem)); } else { treeViewItem.OnCollapsed(new RoutedEventArgs(TreeViewItem.CollapsedEvent, treeViewItem)); } treeViewItem.UpdateVisualState(); }
private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TreeViewItem item = (TreeViewItem)d; bool isSelected = (bool)e.NewValue; item.Select(isSelected); TreeViewItemAutomationPeer peer = UIElementAutomationPeer.FromElement(item) as TreeViewItemAutomationPeer; if (peer != null) { peer.RaiseAutomationIsSelectedChanged(isSelected); } if (isSelected) { item.OnSelected(new RoutedEventArgs(SelectedEvent, item)); } else { item.OnUnselected(new RoutedEventArgs(UnselectedEvent, item)); } item.UpdateVisualState(); }
private static void OnIsExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TreeViewItem item = (TreeViewItem)d; bool isExpanded = (bool)e.NewValue; TreeView tv = item.ParentTreeView; if (tv != null) { if (!isExpanded) { tv.HandleSelectionAndCollapsed(item); } } ItemsPresenter itemsHostPresenter = item.ItemsHostPresenter; if (itemsHostPresenter != null) { // In case a TreeViewItem that wasn't previously expanded is now // recycled to represent an entity that is expanded or viceversa, we // face a situation where we need to synchronously remeasure the // sub tree through the ItemsPresenter leading up to the ItemsHost // panel. If we didnt do this the offsets could get skewed. item.InvalidateMeasure(); Helper.InvalidateMeasureOnPath(itemsHostPresenter, item, false /*duringMeasure*/); } TreeViewItemAutomationPeer peer = UIElementAutomationPeer.FromElement(item) as TreeViewItemAutomationPeer; if (peer != null) { peer.RaiseExpandCollapseAutomationEvent((bool)e.OldValue, isExpanded); } if (isExpanded) { item.OnExpanded(new RoutedEventArgs(ExpandedEvent, item)); } else { item.OnCollapsed(new RoutedEventArgs(CollapsedEvent, item)); } item.UpdateVisualState(); }
// Token: 0x060058FA RID: 22778 RVA: 0x00189D6C File Offset: 0x00187F6C private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TreeViewItem treeViewItem = (TreeViewItem)d; bool flag = (bool)e.NewValue; treeViewItem.Select(flag); TreeViewItemAutomationPeer treeViewItemAutomationPeer = UIElementAutomationPeer.FromElement(treeViewItem) as TreeViewItemAutomationPeer; if (treeViewItemAutomationPeer != null) { treeViewItemAutomationPeer.RaiseAutomationIsSelectedChanged(flag); } if (flag) { treeViewItem.OnSelected(new RoutedEventArgs(TreeViewItem.SelectedEvent, treeViewItem)); } else { treeViewItem.OnUnselected(new RoutedEventArgs(TreeViewItem.UnselectedEvent, treeViewItem)); } treeViewItem.UpdateVisualState(); }