none
Jumplist Selector,Grouping, Bind on OdataService, windows Phone 8

    Question

  • I have Created my jump list selecter bind on Two Classes Table and Order , but i want now to bind it on my Odata Service, Using MVVM ,any one have any idea how to consume Odata Service so i can bind it to my jumpList ,

    This is my current Code , please help !!

      <!--ContentPanel - place additional content here-->
            <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                <phone:LongListSelector
    				x:Name="AddrBook"
    				JumpListStyle="{StaticResource AddrBookJumpListStyle}"
    				Background="Transparent"
    				GroupHeaderTemplate="{StaticResource AddrBookGroupHeaderTemplate}"
    				ItemTemplate="{StaticResource AddrBookItemTemplate}"
    				LayoutMode="List"
                    IsGroupingEnabled="true"
    				HideEmptyGroups ="true">
                    
                </phone:LongListSelector>
            </Grid>
    

     public partial class MainPage : PhoneApplicationPage
        {
            LoginTableOrderViewModel LTOVM = new LoginTableOrderViewModel();
            public MainPage()
            {
                InitializeComponent();
                List<Table> source = new List<Table>();
                //DataContext = LTOVM;
                source.Add(new Table("Table1", "1", "Bar", "BarSud"));
                source.Add(new Table("Table2", "2", "Bar", "BarSud"));
                source.Add(new Table("Table3", "3", "Bar", "BarSud"));
                source.Add(new Table("Table4", "4", "Bar", "BarSud"));
                source.Add(new Table("Table5", "5", "Bar", "BarSud"));
                source.Add(new Table("Table5", "6", "Bar", "BarSud"));
                source.Add(new Table("Table3", "7", "Bar", "BarSud"));
                source.Add(new Table("Table4", "8", "Bar", "BarSud"));
                source.Add(new Table("Table6", "9", "Bar", "BarSud"));
                source.Add(new Table("Table7", "10", "Bar", "BarSud"));
                source.Add(new Table("Table8", "11", "Bar", "BarSud"));
                source.Add(new Table("Table9", "12", "Bar", "BarSud"));
                source.Add(new Table("Table10", "13", "Bar", "BarSud"));
                source.Add(new Table("Table11", "14", "Bar", "BarSud"));
    
                List<Order> Orders = new List<Order>();
                Orders.Add(new Order("Order9", "11", source[0], "FamilyOrder"));
                Orders.Add(new Order("Order1", "1", source[1], "FamilyOrder"));
                Orders.Add(new Order("Order2", "2", source[2], "FamilyOrder"));
                Orders.Add(new Order("Order3", "3", source[3], "FamilyOrder"));
                Orders.Add(new Order("Order4", "4", source[4], "FamilyOrder"));
                Orders.Add(new Order("Order5", "5", source[5], "FamilyOrder"));
                Orders.Add(new Order("Order6", "6", source[6], "FamilyOrder"));
                Orders.Add(new Order("Order7", "7", source[7], "FamilyOrder"));
                Orders.Add(new Order("Order8", "8", source[8], "FamilyOrder"));
                Orders.Add(new Order("Order9", "9", source[9], "FamilyOrder"));
                Orders.Add(new Order("Order9", "10", source[10], "FamilyOrder"));
                Orders.Add(new Order("Order9", "11", source[11], "FamilyOrder"));
    
             
                List<Grouping<Order>> _groups = Grouping<Order>.GetItemGroups(Orders, x => x.OrderTable.TableName);
    
                AddrBook.ItemsSource = _groups;
            
                          
            }
              
                   
        }

     public class Grouping<T>:List<T>
        {
    
    
            public Grouping(string name, IEnumerable<T> items)
               :base(items) 
            {
                this.Key = name;
            }
    
    
    
            public string Key
            {
                get;
                set;
            }
    
    
    
    
            public static List<Grouping<T>> GetItemGroups(IEnumerable<T> itemList, Func<T,
                string> getKeyFunc)
            {
    
                IEnumerable<Grouping<T>> groupList = from item in itemList
                                                     group item by getKeyFunc(item)
                                                         into g
                                                         orderby g.Key ascending
                                                         select new Grouping<T>(g.Key, g);
    
                return groupList.ToList();
            }
    
          
    
    
    
    
    
        }

     
    Monday, March 24, 2014 3:31 PM