This is a migrated thread and some comments may be shown as answers.

Move the RadTreeViewItems in specific distances

1 Answer 72 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Lauren Nickerson
Top achievements
Rank 1
Lauren Nickerson asked on 03 Sep 2010, 10:48 PM
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.

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 08 Sep 2010, 02:15 PM
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
Tags
TreeView
Asked by
Lauren Nickerson
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or