Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Binding a sorted dictionary to xamdatatree
posted

I'm trying to explore what is the best way to bind and sorted dictionary collection to xamdatatree.

My goal is to index student names by alphabets for each school.

My data tree should look like - 

School Name1

    - A

        - Ash

        - Asta

        - Arod

        - Azura

    - B

        - Bobby

        - Bpranden

        - Bxosch

School Name2

    - A

        - Astro

        - Atrak

    - K

        - Krak

        - Ktul

My class is :

public class School

{

 public string Name { get; set; }

 public SortedDictionary<char, string> StudentNameByIndex { get; set}

}


Parents
  • 21382
    posted

    The XamDataTree is going to walk the ItemSource as an IEnumerable and if the data object has an IEnumerable member, attempt to walk that.  So your datasource would need to reflect data in that manner.

     

    So for this kind of set up you would need a data object 

    class Letter { 

    string Letter {get;set}

    IEnumerable KidsWithThatLetter{get;set}

    }

     

    The IEnumeable would be the list of students that would fall under that letter.

Reply Children
No Data