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

Sorting on OnWindowLoaded collapses all groups ? (using IsolatedStorage)

3 Answers 66 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 15 Jun 2016, 03:22 PM

Hi,

I'm using Isolated Storage, and save a value to both the TreeListView and it's GridViewDataColumn...but when my page comes up the saved sorting value is not being used, so I have to use a third value and read it and manually sort:

 

XAML:

            <telerik:Label x:Name="ProjectTreeViewOrdering" Content="ASC" Visibility="Collapsed" telerik:PersistenceManager.StorageId="THOR_ProjectsTreeSorting" />

 

CODE:

        string[] projectsSortingIsolatedStorage = { "THOR_ProjectsTreeSorting" };

 

        private void OnWindowLoaded(object sender, EventArgs e)
        {

                isoProvider.LoadFromStorage(projectsSortingIsolatedStorage);

                IEnumerable<TreeProjectViewModel> projects = ProjectsTreeView.ItemsSource as IEnumerable<TreeProjectViewModel>;
                if (ProjectTreeViewOrdering.Content.Equals("Ascending"))
                {
                    ProjectsTreeView.ItemsSource = projects.OrderBy(p => p.Name);
                }
                else if (ProjectTreeViewOrdering.Content.Equals("Descending"))
                {
                    ProjectsTreeView.ItemsSource = projects.OrderByDescending(p => p.Name);
                }

...which gets my TreeListView sorted, but then all the Groups collapse, which I don't want.

Using "ExpandAllGroups" had no effect.

If anyone has a better and more proper way to sort, save, and load a RadTreeListView that has a GridViewDataColumn defined within it, I sure would love to know about it. To get the list sorting to persist, I currently have a value save in the TreeListView, the GridViewDataColumn, and a "desperate" label as seen above.3 values seems like overkill to get the job done. I found without the value int he GridViewDataColumn being saved, I'd get no arrows in the TreeListView control, which was bad. Without the label value being stored, I got no sorting capability....so it's all bad at the moment.

Barry

 

 

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 17 Jun 2016, 07:37 AM
Hi Barry,

For expanding the hierarchy items of RadTreeListView, you can try using the ExpandAllHierarchyItems() method of the control. If you do not need to expand all items, but a particular one, you can benefit from the ExpandHierarchyItem() method.

Additionally, you may find the Expand all rows topic useful on this matter.

I hope this helps.

Regards,
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 21 Jun 2016, 05:04 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

0
Stefan
Telerik team
answered on 22 Jun 2016, 11:26 AM
Hi Barry,

I already replied you in the other forum thread you opened regarding this question. In order to keep this thread consistent, I would kindly ask you to continue any further communication regarding this topic in it.

Best Regards,
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