Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. How to sort the items under some node in Silverlight tree view?

How to sort the items under some node in Silverlight tree view?

Scheduled Pinned Locked Moved WPF
data-structurestutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tesic Goran
    wrote on last edited by
    #1

    How to sort the items under some node in Silverlight tree view? Thank you in advance. Regards, Goran

    S 1 Reply Last reply
    0
    • T Tesic Goran

      How to sort the items under some node in Silverlight tree view? Thank you in advance. Regards, Goran

      S Offline
      S Offline
      SledgeHammer01
      wrote on last edited by
      #2

      Are you using proper data binding for your tree? Or are you hand inserting items? If you hand inserted, no choice but to rearrange by hand. If you are using data binding, just sort that part of the collection and the UI will auto-magically update.

      T 1 Reply Last reply
      0
      • S SledgeHammer01

        Are you using proper data binding for your tree? Or are you hand inserting items? If you hand inserted, no choice but to rearrange by hand. If you are using data binding, just sort that part of the collection and the UI will auto-magically update.

        T Offline
        T Offline
        Tesic Goran
        wrote on last edited by
        #3

        I'm manually inserting data, but in WPF this works for me:

          // Sort actions and statuses by time
          if (treeAdditionalInfo.Items.Count != 0)
          {
            foreach (TreeViewItem subsystemNodeItem in treeAdditionalInfo.Items)
            {
              foreach (TreeViewItem formNodeItem in subsystemNodeItem.Items)
              {
                formNodeItem.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("Tag",
                  System.ComponentModel.ListSortDirection.Ascending));
              }
            }
          }
        

        It means, I want to sort the node items by Tag property of items. I can't see I could do the same in Silverlight. I've tried to find something on internet, but no luck so far. I appreciate any help. Thanks.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups