Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <GroupStyle>
  2. <GroupStyle.HeaderTemplate>
  3. <DataTemplate>
  4. <TextBlock Text='{Binding Key}' Foreground="{StaticResource ApplicationForegroundThemeBrush}" Margin="5" FontSize="18" FontFamily="Segoe UI" FontWeight="Light" />
  5. DataTemplate>
  6. </GroupStyle.HeaderTemplate>
  7. </GroupStyle>
  8.  
  9. public List<ItemList> CreateGroupedData()
  10. {
  11. if (ReceivedList!= null)
  12. {
  13. var result =
  14. from t in ReceivedList
  15. group t by t.GroupField into g
  16. orderby g.Key
  17. select new { Key = g.Key, Items = g };
  18.  
  19. List<ItemList> lists = new List<ItemList>();
  20. foreach (var i in result)
  21. {
  22. ItemList list = new ItemList();
  23. list.Key = $"{i.Key.ToString)} [{i.Items.Count.ToString()}]";
  24. lists.Add(list);
  25. }
  26. return lists;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement