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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:39:20+00:00 2026-05-11T15:39:20+00:00

I have a ListView that displays sales orders, and groups them by status. In

  • 0

I have a ListView that displays sales orders, and groups them by status. In WinForms I had a footer at the bottom of each group that displayed the Total sale price for each group, and I would like to do the same in WPF.

I have figured out how to group the orders, but I can’t figure out how to create a footer.

This is my current group style:

<ListView.GroupStyle>             <GroupStyle HidesIfEmpty='True'>                 <GroupStyle.HeaderTemplate>                     <DataTemplate>                         <!--CollectionViewGroup.Name will be assigned the value of Status for that group.-->                         <!--http://stackoverflow.com/questions/639809/how-do-i-group-items-in-a-wpf-listview-->                         <Grid>                             <Grid.ColumnDefinitions>                                 <ColumnDefinition Width='*' />                                 <ColumnDefinition Width='*' />                             </Grid.ColumnDefinitions>                             <TextBlock Grid.Column='0' Text='{Binding Path=Name}' HorizontalAlignment='Left' FontWeight='Bold'  Foreground='Black'/>                             <Line Grid.Column='1' Stroke='Black' X2='500' Fill='Black' VerticalAlignment='Center' />                         </Grid>                     </DataTemplate>                 </GroupStyle.HeaderTemplate>             </GroupStyle>         </ListView.GroupStyle> 
  • 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. 2026-05-11T15:39:20+00:00Added an answer on May 11, 2026 at 3:39 pm

    If your looking for something like this:

    WPF Grouping with Total Sums
    (source: bendewey.com)

    Then you can use the Template property of the ContainerStyle for the GroupStyle. In this example I use a DockPanel, with the Grid you supplied Docked on the bottom and an ItemsPresenter filling the remainder. In addition in order to get the Items totaled you’d have to use a Converter, which is supplied at the bottom.

    Window.xaml

    <Window     xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'     xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'     x:Class='WpfApplication1.Window3'     x:Name='Window'     Title='Window3'     xmlns:local='clr-namespace:WpfApplication1'     Width='640' Height='480'>     <Window.Resources>         <local:MyDataSource x:Key='MyData' />         <CollectionViewSource x:Key='ViewSource' Source='{Binding Source={StaticResource MyData}, Path=Users}'>             <CollectionViewSource.GroupDescriptions>                 <PropertyGroupDescription PropertyName='Country' />             </CollectionViewSource.GroupDescriptions>         </CollectionViewSource>     </Window.Resources>     <Grid x:Name='LayoutRoot'>       <ListView ItemsSource='{Binding Source={StaticResource ViewSource}}'>         <ListView.GroupStyle>             <GroupStyle>                 <GroupStyle.ContainerStyle>                     <Style TargetType='{x:Type GroupItem}'>                         <Setter Property='Template'>                             <Setter.Value>                                 <ControlTemplate TargetType='{x:Type GroupItem}'>                                       <DockPanel>                                         <Grid DockPanel.Dock='Bottom'>                                             <Grid.Resources>                                                 <local:TotalSumConverter x:Key='sumConverter' />                                             </Grid.Resources>                                             <Grid.ColumnDefinitions>                                                 <ColumnDefinition Width='*' />                                                 <ColumnDefinition Width='*' />                                             </Grid.ColumnDefinitions>                                             <Grid.RowDefinitions>                                                 <RowDefinition />                                                 <RowDefinition />                                             </Grid.RowDefinitions>                                             <StackPanel Orientation='Horizontal'>                                                 <TextBlock Grid.Column='0' Text='Total: ' FontWeight='Bold'/>                                                 <TextBlock Grid.Column='0' Text='{Binding Path=Name}' />                                             </StackPanel>                                             <Line Grid.Column='1' Stroke='Black' X2='500' Fill='Black' VerticalAlignment='Center' />                                              <TextBlock Grid.Row='1' Grid.Column='1' HorizontalAlignment='Right' Text='{Binding Path=Items, Converter={StaticResource sumConverter}}' />                                         </Grid>                                     <ItemsPresenter />                                 </DockPanel>                                 </ControlTemplate>                             </Setter.Value>                         </Setter>                     </Style>                 </GroupStyle.ContainerStyle>             </GroupStyle>         </ListView.GroupStyle>         <ListView.View>            <GridView>             <GridViewColumn Width='140' Header='Name' DisplayMemberBinding='{Binding Name}'/>             <GridViewColumn Width='140' Header='Phone Number' DisplayMemberBinding='{Binding Phone}'/>             <GridViewColumn Width='140' Header='Country' DisplayMemberBinding='{Binding Country}' />             <GridViewColumn Width='140' Header='Total' DisplayMemberBinding='{Binding Total}' />            </GridView>           </ListView.View>       </ListView>      </Grid> </Window> 

    MyDataSource.cs

    public class MyDataSource {     public ObservableCollection<User> Users { get; set; }      public MyDataSource()     {         Users = new ObservableCollection<User>();         LoadDummyData();     }      private void LoadDummyData()     {         Users.Add(new User()         {             Name = 'Frank',             Phone = '(122) 555-1234',             Country = 'USA',             Total = 432         });          Users.Add(new User()         {             Name = 'Bob',             Phone = '(212) 555-1234',             Country = 'USA',             Total = 456         });          Users.Add(new User()         {             Name = 'Mark',             Phone = '(301) 555-1234',             Country = 'USA',             Total = 123         });          Users.Add(new User()         {             Name = 'Pierre',             Phone = '+33 (122) 555-1234',             Country = 'France',             Total = 333         });          Users.Add(new User()         {             Name = 'Jacques',             Phone = '+33 (122) 555-1234',             Country = 'France',             Total = 222         });          Users.Add(new User()         {             Name = 'Olivier',             Phone = '+33 (122) 555-1234',             Country = 'France',             Total = 444         });     } } 

    User.cs

    public class User {     public string Name { get; set; }     public string Phone { get; set; }     public string Country { get; set; }     public double Total { get; set; } } 

    TotalSumConverter.cs

    public class TotalSumConverter : IValueConverter {     public object Convert(object value, Type targetType, object parameter, CultureInfo culture)     {         var users = value as IEnumerable<object>;         if (users == null)             return '$0.00';          double sum = 0;          foreach (var u in users)         {             sum += ((User)u).Total;         }           return sum.ToString('c');     }      public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)     {         throw new System.NotImplementedException();     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView that displays items, each item is a ListView. the problem
I have a ListView that displays comments for an article. Each comments has a
I have a ListView that displays a link button. I need the link button
I have a ListView that displays a shopping cart. It was working fine until
I have a list view that displays a collection of items, each item has
In one of my Activities I have a ListView that displays a list of
I have a ListView-like control that displays a list of items of various heights.
I have a listview that displays a list of profiles added by a user.
I have a ListView that displays error to the user. Part of it also
I have a Gallery control that displays a ListView as its adapter view. my

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.