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 780763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:07:36+00:00 2026-05-14T20:07:36+00:00

I have to group the data int the datagrid. I have done following for

  • 0

I have to group the data int the datagrid.
I have done following for that:

  1. Have added the style to resources as:
> <Style x:Key="GroupHeaderStyle"
> TargetType="{x:Type GroupItem}">
>         <Setter Property="Template">
>             <Setter.Value>
>                 <ControlTemplate TargetType="{x:Type GroupItem}">
>                     <Expander IsExpanded="False"
>                      >
>                         <Expander.Header>
>                             <TextBlock Text="{Binding Name}"/>
>                 </Expander.Header>
>                         <ItemsPresenter />
>                     </Expander>
>                 </ControlTemplate>
>             </Setter.Value>
>         </Setter>
>     </Style>
  1. I have applied the style as:
    <dg:DataGrid Grid.Row="1" Name="dgAuthor" HorizontalScrollBarVisibility="Hidden"
AutoGenerateColumns="False" RowHeaderWidth="17" RowHeight="25">
                <dg:DataGrid.GroupStyle>
                    <GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle}">
                        <GroupStyle.Panel>
                            <ItemsPanelTemplate>
                                <dg:DataGridRowsPresenter/>
                            </ItemsPanelTemplate>
                        </GroupStyle.Panel>
                    </GroupStyle>
                </dg:DataGrid.GroupStyle>
           </dg:DataGrid>
  1. I have infoList as a ObservableCollection and have assigned it as itemssource as follows:

    ListCollectionView lcv = new ListCollectionView(infoList);
    lcv.GroupDescriptions.Add(new PropertyGroupDescription(“Author”));
    dgAuthor.ItemsSource = lcv;

where Info is class which has Author,Book,Year properties.

I have to group the datagrid on Author property.
I am able to display the explander but cannot see any rows in it.
Can anybody tell me whats wrong with the code?

  • 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-05-14T20:07:37+00:00Added an answer on May 14, 2026 at 8:07 pm

    Setting AutoGenerateColumns="True" explicitely solves the problem.
    I also added the column definitions.

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

Sidebar

Related Questions

I have some html like the following: <div class=control-group> <input type=text data-bind=value: $data.DealCode name=DealCode
I have a query that returns data with group category and some details like
I have some data that has various attributes and I want to hierarchically group
I have the following data: <media:group> <media:content url=http://www.url.com bitrate=450 width=320 duration=32 /> <media:content url=http://www.url.com
I have user and group tables set up as the following. users id int
I have a read-only datagrid bound to a domain data source. The data that
I have a table called data: create table data ( ID int primary key,
I have data in my database that looks like this: Date (DateTime) Type (varchar)
I have a radiobutton group in Android that I populate with data from a
I am trying to group some data without much luck. I have a list

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.