nature_net.user_controls.ItemsControlExtensions.ScrollToCenterOfView C# (CSharp) Метод

ScrollToCenterOfView() публичный статический Метод

public static ScrollToCenterOfView ( this itemsControl, object item ) : void
itemsControl this
item object
Результат void
        public static void ScrollToCenterOfView(this ItemsControl itemsControl, object item)
        {
            // Scroll immediately if possible
            if (!itemsControl.TryScrollToCenterOfView(item))
            {
                // Otherwise wait until everything is loaded, then scroll
                if (itemsControl is ListBox) ((ListBox)itemsControl).ScrollIntoView(item);
                itemsControl.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new System.Action(() =>
                {
                    itemsControl.TryScrollToCenterOfView(item);
                }));
            }
        }