Ejemplo n.º 1
0
        private static object OnCoerceTopIndexProperty(DependencyObject sender, object data)
        {
            ExtendedListView listView = sender as ExtendedListView;
            int topIndex = (int)data;

            if (topIndex > listView.Items.Count - 1)
            {
                return(listView.Items.Count - 1);
            }

            if (topIndex < 0)
            {
                return(0);
            }

            return(topIndex);
        }
Ejemplo n.º 2
0
        private static void OnTopIndexChangedProperty(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            ExtendedListView listView = source as ExtendedListView;

            if (listView.Items.Count == 0)
            {
                return;
            }

            ScrollViewer scrollViewer = GetChildOfType <ScrollViewer>(listView);

            if (scrollViewer != null)
            {
                scrollViewer.ScrollToBottom();
                listView.ScrollIntoView(listView.Items[listView.TopIndex]);
            }
        }