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

  • SEARCH
  • Home
  • 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 8887955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:55:58+00:00 2026-06-14T21:55:58+00:00

WinPhone 8 project in C#. I’m trying to populate a grouped list. The group

  • 0

WinPhone 8 project in C#. I’m trying to populate a grouped list. The group headers appear, the items don’t. The relevant code is:

class MyPage
{
    public class Group : IGrouping<string, string>
    {
        public string Title{get;set;}
        public string[] Items;

        public string Key
        {
            get { return Title; }
        }

        public IEnumerator<string> GetEnumerator()
        {
            return (Items as IEnumerable<string>).GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return Items.GetEnumerator();
        }
    }

    private Group[] m_ItemGroups =
        {
            new Group(){Title = "A", Items = new string[] {"A", "ASA"}},
            new Group(){Title = "X", Items = new string[] {"X", "XX"}},
        };

    private void OnLoaded(object sender, RoutedEventArgs e)
    {
        TheList.ItemsSource = m_ItemGroups;
    }
}

And the XAML:

<phone:LongListSelector
        x:Name="TheList"
        Grid.Row="1"
        IsGroupingEnabled="True"
        SelectionChanged="OnSelChanged"
        >

        <phone:LongListSelector.GroupHeaderTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Title}"
                   Style="{StaticResource PhoneTextGroupHeaderStyle}"
                   Foreground="{StaticResource PhoneForegroundBrush}" />
            </DataTemplate>
        </phone:LongListSelector.GroupHeaderTemplate>

        <phone:LongListSelector.ItemTemplate>
            <DataTemplate>
                <StackPanel Margin="0,0,0,17" Width="432" Orientation="Horizontal">
                    <TextBlock Text="Hello world" TextWrapping="Wrap" Width="345"/>
                </StackPanel>

            </DataTemplate>
        </phone:LongListSelector.ItemTemplate>

    </phone:LongListSelector>

Neither of the GetEnumerator() methods is called. The Key getter is never called, either. Looks like the list does not recognize my Group class as a collection of strings that it is. Please, what’s wrong here?

The item template is fine. When I change the list to non-grouped, I see two items with dummy text.

Replacing the string as the item type with a custom class does not help.

  • 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-14T21:55:59+00:00Added an answer on June 14, 2026 at 9:55 pm

    Looks like LongListSelector expects, in grouped mode, that the objects in the ItemsSource collection implement System.Collections.IList (untyped). A simple IEnumerator won’t do.

    I wish that was documented. So far, WP8 SDK docs suck big time.

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

Sidebar

Related Questions

I am trying to create an application bar in code for WinPhone7. The XAML
A Windows Phone application referencing a dll(another class library project). There is an asynchronous
I'm trying to introduce myself into the MVVMCross project, but I can not run
In my WinPhone app I'm accessing a REST service. At the beginnings I was
I'm just starting out in WinPhone development and can't figure out how to set
I am writing video based social app for iOS and android(WinPhone is under waiting).
I'm trying to write a win phone 7 app for the first time -
I can't get WinPhone 7 SDK update v7.1.1 to install. It freezes my computer
I'm a frontend dev with no windows phone dev experience trying to put together
What is the difference between the winphone 7 Panorama and Pivot Controls? To me

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.