Windows Phone 7 Jump List Groups By Alphabetical Order

426 views Asked by At

I have a jump list which groups by individual entries but i wanted to group list by alphabets

var ANBA = from accountsTable in dataSource
           orderby accountsTable.Extra
           group accountsTable by accountsTable.Extra.Substring(0, 1) into c
           orderby c.Key
           select new Group<AccountsTable>(c.Key, c);

this.AccountsList2.ItemsSource = ANBA;

this code makes list with small letter & capital letter with different group

a
    ab
    ac
    ad
A
    Aa
    Ab
    Ac

How to make it where small letter & capital letter will be in same group & all the other characters in single group like all the numbers & characters

a 
    Aa
    ab
    ad
    AGDS
*
    1
    5000
    @@ASD
1

There are 1 answers

5
Benoit Catherinet On BEST ANSWER

Here is how to modify the query to do that:

List<Table> Source = new List<Table>();

var ANBA = from accountsTable in Source 
                  orderby table.Extra
                   group table by (( table.Extra[0]>='a' &&table.Extra[0]<='z' )
                      ||( table.Extra[0]>='A' &&table.Extra[0]<='Z' ) ?table.Extra.Substring(0,1).ToUpper()[0]:'*')  into c
                   orderby c.Key
                   select new Group<Table>(c.Key.ToString(), c);

        this.ANListGropus.ItemsSource = ANBA;