Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
Item count not shown in the group by
posted

I have a question on the XamDataGrid. I have a datetiem column in the grid. This column's GroupByMode is set to OutlookDate. When I use this column as the group by field. The data rows are grouped by Today, Yesterday and Tuesday. However, the item count is not shown. Is any way to show the item count? The following is a snapshot of the grid.

 

  • 138253
    Offline posted

    Hello,

     

    I am just checking if you got this worked out or you still require any assistance or clarification on the matter.

  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I suggest you define your DateTime Field like this:

    <igDP:Field Name="Date">
        <igDP:Field.Settings>
            <igDP:FieldSettings GroupByMode="OutlookDate">
                <igDP:FieldSettings.GroupByRecordPresenterStyle>
                    <Style TargetType="{x:Type igDP:GroupByRecordPresenter}">
                        <EventSetter Event="Loaded" Handler="GBRPLoaded"/>
                    </Style>
                </igDP:FieldSettings.GroupByRecordPresenterStyle>
            </igDP:FieldSettings>
        </igDP:Field.Settings>
    </igDP:Field>
    

     

    And add the following handler for the GroupByRecordPresenter’s Loaded event:

    private void GBRPLoaded(object sender, RoutedEventArgs e)
    {
        GroupByRecord record = ((sender as GroupByRecordPresenter).Record as GroupByRecord);
    
        if (record.ChildRecords.Count() == 1)
        {
            record.Description += " (" + record.ChildRecords.Count().ToString() + " item)";
        }
        else
            record.Description += " (" + record.ChildRecords.Count().ToString() + " items)";  
    }
    

     

    Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.