/// <summary> /// Returns a value indicating whether a given items control /// can scroll. /// </summary> /// <param name="itemsControl">The items control.</param> /// <returns>The value indicating whether the given items control /// can scroll.</returns> protected override bool CanScroll(ItemsControl itemsControl) { TreeView content = this.Content as TreeView; if (content != null) { return(content.GetScrollHost() != null); } return(false); }
/// <summary> /// Scrolls a given item container into the view. /// </summary> /// <param name="itemsControl">The items control that contains /// the item container.</param> /// <param name="itemContainer">The item container to scroll into /// view.</param> protected override void ScrollIntoView(ItemsControl itemsControl, TreeViewItem itemContainer) { TreeView content = this.Content as TreeView; if (content != null) { ScrollViewer scrollViewer = content.GetScrollHost(); if (scrollViewer != null) { scrollViewer.ScrollIntoView(itemContainer, 10, 10, ScrollItemAnimationDuration); } } }