Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8444941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:31:48+00:00 2026-06-10T09:31:48+00:00

I have a dictionary where key is a String and element is a List

  • 0

I have a dictionary where key is a String and element is a List

I want to create a group from every key with elements from element. But I don`t know how to make it

<Page.Resources>
    <!--
        Collection of grouped items displayed by this page, bound to a subset
        of the complete item list because items in groups cannot be virtualized
    -->
    <CollectionViewSource
        x:Name="groupedItemsViewSource"
        IsSourceGrouped="true"
        />

</Page.Resources>

<GridView ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
      IsSwipeEnabled="True">
            <GridView.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding name}"
           Foreground="White" />
                </DataTemplate>
            </GridView.ItemTemplate>
            <GridView.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </GridView.ItemsPanel>
            <GridView.GroupStyle>
                <GroupStyle>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
<TextBlock Text="Test 123" Foreground="Gold" />
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                    <GroupStyle.Panel>
                        <ItemsPanelTemplate>
                            <VariableSizedWrapGrid Orientation="Vertical" />
                        </ItemsPanelTemplate>
                    </GroupStyle.Panel>
                </GroupStyle>
            </GridView.GroupStyle>
        </GridView>

In loop I create the dictionary

groups.Add(this.letters[i], items);

and after that I have

groupedItemsViewSource.Source = groups;

But I get nothing. How should I correct this to have a key as group title and every list as a list of elements in this grid ??

// EDIT

Ok I found that making List> instead of Dictionary is better. I get now 3 group headers (cause I got 3 lists in my list) but have no items. IMO this is better way than the first

// EDIT 2
I didn`t see items cause background and foreground were white. Stupid me 🙂 But now I have last problem to solve. How to dynamicly set groups titles ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:31:50+00:00Added an answer on June 10, 2026 at 9:31 am

    You actually don’t have to create custom classes to enable grouping. In fact you can use LINQ to do it for you:

    var result = from act in Activities group act by act.Project into grp
    orderby grp.Key select grp;

    cvsActivities.Source = result;

    In order to show grouped items in a GridView you must use CollectionViewSource. Just setting the groups as the GridView.ItemsSource will not work. You must set GridView.ItemsSource = a CollectionViewSource and CollectionViewSource must point to the groups. You will also likely have to set CollectionViewSource.IsSourceGrouped = true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Dictionary from string key i want to get Value of corresponding key
I have a Dictionary<int, string> which I want to take the Key collection into
I am trying to remove elements from a Dictionary<string, List<string>> in C# when the
I have a dictionary with 3 values associated to each key, I want to
I have dictionary of about 20,000 objects The key is a string representation of
I have an object that contains a property: public Dictionary<string, List<Hotel>> CityHotels { get;
I have a Dictionary where the key and value are both strings. It's possible
I have a dictionary: (key is 'name' and value is other dictionary) dictionary =
I have a dictionary with key-value pairs like {a : (b,c,d,e)} . If i
Does VBA have dictionary structure? Like key<>value array?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.