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

[Solved] BringIntoView does not work

3 Answers 231 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Reden
Top achievements
Rank 1
Reden asked on 09 Jun 2009, 06:45 PM
I'm trying to add logic on my code for the treeview where it selects the newly added item.  After the row is added (not saved yet), I set the IsSelected and IsExpanded property of the new treeview item to TRUE, then I call treeViewItem.BringIntoView().  The newly added row gets selected and expanded, but the scroll bar does not scroll down automatically to bring the newly added row into view.  Is there an existing bug for BringIntoView() in RadTreeViewItem?  If so, is there a work-around to handle this issue?

Thank you,
Reden 

3 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 10 Jun 2009, 05:26 PM
Hello Reden,

Please find attached a sample project that demonstrates how to accomplish your goals.

All you need to do in order to have correctly working TreeView with scrolls is just to add something like this:
  
private void Button_Click(object sender, RoutedEventArgs e)
        {
            RadTreeViewItem item1 = new RadTreeViewItem();
            item1.Header = "item1";
            this.treeView.Items.Add(item1);
            item1.IsSelected = true;
            item1.IsExpanded = true;
            Dispatcher.BeginInvoke(() =>
            {
                item1.BringIntoView();
            });
        }

I hope that this answers your question.

All the best,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Reden
Top achievements
Rank 1
answered on 10 Jun 2009, 06:23 PM
Hi Boryana,

Thanks for the quick reply.  The solution you've provided works up to a certain extent.  When adding a new treeview item on a treeview with 1 level of item, it works fine.  The scenario I'm working on is on a 5 level treeview, where I'm adding a new child treeview item in the middle of the tree.  For example, the new child treeview item is for the 2nd level, where the 2nd level has more child items that users should scroll the scroll bar all the way to the last child item just to view them.  In this example, the BringIntoView fails from scrolling the vertical scrollbar all the way to the viewable level of the new child item (in this case, the last item in the 2nd level).

Thanks again,
Reden
0
Bobi
Telerik team
answered on 11 Jun 2009, 10:47 AM
Hello Reden,

We deeply apologize for the caused inconvenience. We will fix this issue as soon as possible and the change will be reflected in our Q2 release which is at the end of June/the beginning of July.

Your Telerik points are updated.


Regards,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Reden
Top achievements
Rank 1
Answers by
Bobi
Telerik team
Reden
Top achievements
Rank 1
Share this question
or