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

Is there a way to preserve/save the expanded groups using isolated storage ?

3 Answers 92 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 21 Jun 2016, 05:06 PM

Is there a way to preserve the expanded groups *using isolated storage* ?....I managed to get the sorting saving, but not the user expanded groups, so that when the app is run again the groups that were expanded previously remain expanded as the user left them (which is a business requirement of our app).

Thanks,

 

Barry

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 22 Jun 2016, 11:25 AM
Hello Barry,

In order to expand the items of RadTreeListView when the control's settings are reloaded from the storage, you can call the ExpandHierarchyItem() method for each item needed. For achieving this, you can subscribe to the RowIsExpandedChanged event of the control. Within the event handler you can get the expanded item through the DataContext of the row and cast it to the needed object type. Please take a look at the snippet below.
private void treeListView_RowIsExpandedChanged(object sender,
    Telerik.Windows.Controls.GridView.RowEventArgs e)
{
    var item = e.Row.DataContext as Club;
}

After getting the item, you can save it somewhere and when the control is reloaded from the storage, iterate over all saved items and call the ExpandHierarchyItem() for each one.

Additionally, you may find the Events topic useful on the matter.

I hope this helps.

All the best,
Stefan X1
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Barry
Top achievements
Rank 1
answered on 22 Jun 2016, 06:49 PM

I'm a little fuzzy on how the saved value is achieved and re-loaded using IsolatedStorage, based your suggestion....or are you saying to not use IsolatedStorage and use custom code to save the "IsExpanded" value of each object in the list, and then parse the objects int he list OnLoad and expand each based on the custom property ?

If there's a way to do it using IsolatedStorage, then that is what I'm really after...

Thanks,

Barry

0
Accepted
Stefan
Telerik team
answered on 24 Jun 2016, 07:41 AM
Hi Barry,

What I meant in my previous reply, is that you will have to implement some additional logic, so that the items of RadTreeListView are expanded when the control is reloaded. Please excuse me if I was not clear enough.

All the best,
Stefan X1
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
TreeListView
Asked by
Barry
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Barry
Top achievements
Rank 1
Share this question
or