Sorting on OnWindowLoaded collapses all groups ? (using IsolatedStorage)

4 posts, 1 answers
  1. Barry
    Barry avatar
    29 posts
    Member since:
    May 2016

    Posted 15 Jun Link to this post

    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

     

     

     

  2. Answer
    Stefan X1
    Admin
    Stefan X1 avatar
    518 posts

    Posted 17 Jun Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Barry
    Barry avatar
    29 posts
    Member since:
    May 2016

    Posted 21 Jun in reply to Stefan X1 Link to this post

    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

  5. Stefan X1
    Admin
    Stefan X1 avatar
    518 posts

    Posted 22 Jun Link to this post

    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.
Back to Top