Scroll Item Into View ListBox - CSharp System.Windows.Forms

CSharp examples for System.Windows.Forms:ListBox

Description

Scroll Item Into View ListBox

Demo Code


using System.Windows.Threading;
using System.Windows.Controls.Primitives;
using System.Windows.Controls;
using System.Windows;
using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Specialized;
using System.Collections.Generic;
using System;/* ww w  .j a  va  2s. c  o m*/

public class Main{
        static object ScrollItemIntoView_ListBox(object sender)
        {
            ListBox listBox = sender as ListBox;
            if (listBox != null && listBox.SelectedItem != null)
            {
                listBox.ScrollIntoView(listBox.SelectedItem);
            }
            return null;
        }
}

Related Tutorials