RadTreeListView expand rows and set focus on a cell

3 posts, 0 answers
  1. Manohar
    Manohar avatar
    18 posts
    Member since:
    Sep 2010

    Posted 07 Feb 2011 Link to this post

    I have hierarchical data shown on rows and certain cells of the row are editable.

    When a cell is modified, the new data (of the cell) triggers some calculations in my application and I want to refresh the control with the new data.
    When I am refreshing the control with new data, I want to achieve the following:
    1. Expand all the rows that was expanded when the cell data was modified
    2. Scroll to the row where the modification happened
    3. Set focus to the cell that was modified

    Please advise.

  2. Maya
    Maya avatar
    4062 posts

    Posted 11 Feb 2011 Link to this post

    Hi Manohar,

    Generally, if you implement the INotifyPropertyChanged Interface, you do not need to refresh the control so that the changes made are visible. However, I would need a bit more details about you application in order to give more information on the topic. How do you refresh the control ? What field do you want to be recalculated ?
    As far as the particular questions are concerned, please find the answers below: 
    1. You may use the ExpandHierarchyItem and ExpandAllHirerachyItems methods of the RadTreeListView. Those methods will expand either a particular row or all of them.
    2. Once you make the modifications, you need to keep in a variable for example the exact item and call the ScrollIntoView method of the RadTreeListView. The saved item would be the parameter required for the method call.
    3. You may use the CurrentCellInfo property of the RadTreeListView and define the cell you want to focus. Afterwards, all you need to do is to call the Focus method for the control:

    this.RadTreeListView1.CurrentCellInfo = new GridViewCellInfo(this.RadTreeListView1.Items[5], this.RadTreeListView1.Columns[1]);


    Best wishes,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. Manohar
    Manohar avatar
    18 posts
    Member since:
    Sep 2010

    Posted 15 Feb 2011 Link to this post

    Hi Maya,
    Thank you for your suggestions.
    I was able to update the bound in-memory data to make the changes visible.

Back to Top