Microsoft.Silverlight.Testing.Controls.TreeViewItem.BringIntoView C# (CSharp) Method

BringIntoView() private method

Scroll the TreeViewItem into view.
private BringIntoView ( ) : void
return void
        private void BringIntoView()
        {
            // Scroll the TreeViewItem into view when it's expanded
            if (UserInitiatedExpansion)
            {
                UserInitiatedExpansion = false;

                TreeView parent = ParentTreeView;
                if (parent != null)
                {
                    // The child items aren't necessarily in the visual tree yet
                    // so we wait for two ticks to pass before trying to scroll
                    // so there size will be respected.
                    Dispatcher.BeginInvoke(() =>
                    {
                        Dispatcher.BeginInvoke(() =>
                        {
                            // Note that we scroll the entire TreeViewItem into view,
                            // not just its HeaderElement.
                            parent.ItemsControlHelper.ScrollIntoView(this);
                        });
                    });
                }
            }
        }