Move the RadTreeViewItems in specific distances

2 posts, 0 answers
  1. Lauren Nickerson
    Lauren Nickerson avatar
    52 posts
    Member since:
    Jul 2009

    Posted 03 Sep 2010 Link to this post

    Hello, I'm wondering if there's a way that we could move the items in specific intervals when the user moves the items around with page down, page up, home, end, the mouse wheel and even dragging the scrollview bar. The thing is that we don't want to should cropped items on the top edge for the treeview (we don't care about the bottom edge) like this:

    Picture

    We want to always show the whole item like this:

    Picture

    Let me know. Thank you.
  2. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 08 Sep 2010 Link to this post

    Hi Lauren Nickerson,

    Yes there is a way, but you have to do it by yourself. RadTreeView does not support logical scrolling (scrolling item by item). The implementation could be something like this:

    private void StackPanel_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e)
    {
        if (flag)
        {
            flag = false;
            ScrollViewer sv = e.OriginalSource as ScrollViewer;
            int newPos = (int)(e.VerticalOffset / 24) * 24;
            //24 is the default size of RadTreeViewItem
            sv.ScrollToVerticalOffset(newPos);
        }
        else
        {
            flag = true;
        }
    }
    private bool flag = false;

    Hope this helps. Please let us know if you need more help.

    All the best,
    Hristo Milyakov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top