2016-06-30 7 views

答えて

2

各グループのヘッダーテキストは、グループの項目数で変更できます。あなたがキー

public List<ItemList> CreateGroupedData() 
{ 
    if (ReceivedList!= null) 
    { 
     var result = 
     from t in ReceivedList 
     group t by t.GroupField into g 
     orderby g.Key 
     select new { Key = g.Key, Items = g }; 

     List<ItemList> lists = new List<ItemList>(); 
     foreach (var i in result) 
     { 
      ItemList list = new ItemList(); 
      list.Key = $"{i.Key.ToString)} [{i.Items.Count.ToString()}]"; 
      lists.Add(list); 
     } 
     return lists; 
    } 
} 
のテキストでのグループの合計を追加することができますグループ化されたデータを持つリストの作成でGroupStyle

<GroupStyle> 
    <GroupStyle.HeaderTemplate> 
     <DataTemplate> 
      <TextBlock Text='{Binding Key}' Foreground="{StaticResource ApplicationForegroundThemeBrush}" Margin="5" FontSize="18" FontFamily="Segoe UI" FontWeight="Light" /> 
     DataTemplate> 
    </GroupStyle.HeaderTemplate> 
</GroupStyle> 

を持っていると仮定すると

関連する問題