Married Scrolling Between Two Listboxes

3 posts, 1 answers
  1. Jeremy Murtishaw
    Jeremy Murtishaw avatar
    86 posts
    Member since:
    Apr 2009

    Posted 06 Aug 2009 Link to this post

    Hello,

    I'd like to have two listboxes side by side that scroll together, much like you would see in a diff or merge tool. Is there some way that this can be accomplished with Telerik ListBoxes?

    Thanks!
    Jeremy
  2. Answer
    Aaron
    Aaron avatar
    8 posts
    Member since:
    Jul 2009

    Posted 06 Aug 2009 Link to this post

    Jeremy,

    This is possible, and very easy to do. See my example code below.

        public partial class Form1 : Form 
        { 
            public Form1() 
            { 
                InitializeComponent(); 
     
                radListBox1.ListBoxElement.Scroll += new Telerik.WinControls.UI.RadScrollPanelHandler(ListBoxElement_Scroll); 
            } 
     
            void ListBoxElement_Scroll(object sender, Telerik.WinControls.UI.ScrollPanelEventArgs args) 
            { 
                radListBox2.ListBoxElement.ScrollLayoutPanel.ScrollTo(args.NewValue.X, args.NewValue.Y); 
            } 
        } 

    - Aaron


  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jeremy Murtishaw
    Jeremy Murtishaw avatar
    86 posts
    Member since:
    Apr 2009

    Posted 07 Aug 2009 Link to this post

    Thanks Aaron! Worked perfectly :-)

    Jeremy
Back to Top