Home Forums WPF controls Xceed DataGrid for WPF Showing StatFunctions on grouping Detail Line

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • dar100111
    Participant
    Post count: 11
    #44975 |

    Hi Everyone! I bind my Collection in C# and I’ve been able to add Stat Functions like the example code on the below

    This is an example of What the default Details line looks like in the table-view by default when you drag a column to group

    Origin: JFK (2845 items)

    I don’t want to add a footer or header to create another line, I would like to find a simple way to accomplish something like this based off of column values that I can use the stat functions for.

    Origin: JFK (2845 items) (Gross Performance 99.65%) (Net Performance 100.00%) (Total Weight 151515 kgs)

    This is what I was using for the Header Example. Trying to just get it to show on the same line as the grouping items count. Just started looking at these functions today. Any help greatly appreciated.

    C#

    dv =  new DataGridCollectionView(dt.DefaultView);
                    dv.DistinctValuesConstraint = DistinctValuesConstraint.Filtered;
                    dv.AutoFilterMode = AutoFilterMode.And;
    
                    ////GROUP DESCRIPTION FOOTER ROW
                    AverageFunction gPerf = new AverageFunction();
                    gPerf.ResultPropertyName = "GCALC";
                    gPerf.SourcePropertyName = "GROSS_CALC";
    
                    AverageFunction nPerf = new AverageFunction();
                    nPerf.ResultPropertyName = "NCALC";
                    nPerf.SourcePropertyName = "NET_CALC";
    
                    dv.StatFunctions.Add(gPerf);
                    dv.StatFunctions.Add(nPerf);
    
                    dataGridControl1.ItemsSource = dv;
    

    XAML

    
    <xcdg:DataGridControl.DefaultGroupConfiguration>
                    <xcdg:GroupConfiguration InitiallyExpanded="False">
                        <xcdg:GroupConfiguration.Headers>
                            <DataTemplate>
                                <xcdg:StatRow>
                                    <xcdg:StatCell FieldName="GROSS_CALC"
                                  ResultPropertyName="GCALC"/>
                                    <xcdg:StatCell FieldName="NET_CALC"
                                  ResultPropertyName="NCALC"/>                                
                                </xcdg:StatRow>
                            </DataTemplate>
                        </xcdg:GroupConfiguration.Headers>
                    </xcdg:GroupConfiguration>
                </xcdg:DataGridControl.DefaultGroupConfiguration>
    
    Fawzi [Xceed]
    Member
    Post count: 722

    Hi,

    I am not sure if I understood what you mean. Can you give me more details so that I could have a closer look at your requirement.

    dar100111
    Participant
    Post count: 11

    Hi Fawzi! I was just able to figure this out actually using one of the sample apps.

    <xcdg:DataGridControl.DefaultGroupConfiguration>
                    <xcdg:GroupConfiguration InitiallyExpanded="False" DefaultHeadersFootersType="None" >
                        <xcdg:GroupConfiguration.Headers>
                            <xcdg:GroupHeaderFooterItemTemplate VisibleWhenCollapsed="True" >
                                <DataTemplate>
                                    <xcdg:StatGroupHeaderControl ShowGroupLabel="True">
                                        <xcdg:StatGroupHeaderControl.Cells>
                                            <xcdg:StatCell FieldName="GROSS_PERFORMANCE" ResultConverterParameter="[P2]"
                                  ResultPropertyName="GCALC"/>
                                            <xcdg:StatCell FieldName="NET_PERFORMANCE" ResultConverterParameter="[P2]"
                                  ResultPropertyName="NCALC"/>
                                            <xcdg:StatCell FieldName="TOTAL_BUSINESS_DAYS" ResultConverterParameter="[0.00] (StDev)"
                                  ResultPropertyName="TBUSDAYS"/>
                                            <xcdg:StatCell FieldName="TOTAL_CALENDAR_DAYS" ResultConverterParameter="[0.00] (StDev)"
                                  ResultPropertyName="TCALDAYS"/>
                                            <xcdg:StatCell Foreground="Red" FieldName="GROSS_LATE_COUNT" ResultConverterParameter="(Gross Late) [N0]"
                                  ResultPropertyName="GLATE"/>
                                            <xcdg:StatCell Foreground="Red" FieldName="NET_LATE_COUNT"   ResultConverterParameter="(Net Late) [N0]"
                                  ResultPropertyName="NLATE"/>
                                            <xcdg:StatCell Foreground="#009900" FieldName="GROSS_CALC"   ResultConverterParameter="(Gross Ontime) [N0]"
                                  ResultPropertyName="GONTIME"/>
                                            <xcdg:StatCell Foreground="#009900" FieldName="NET_CALC"     ResultConverterParameter="(Net Ontime) [N0]"
                                  ResultPropertyName="NONTIME"/>
                                        </xcdg:StatGroupHeaderControl.Cells>
                                    </xcdg:StatGroupHeaderControl>
                                </DataTemplate>
                            </xcdg:GroupHeaderFooterItemTemplate>
                        </xcdg:GroupConfiguration.Headers>
                    </xcdg:GroupConfiguration>
    
                </xcdg:DataGridControl.DefaultGroupConfiguration>

    For anyone else’s reference

     DataGridCollectionView dv =  new DataGridCollectionView(dt.DefaultView);
                    dv.DistinctValuesConstraint = DistinctValuesConstraint.Filtered;
                    dv.AutoFilterMode = AutoFilterMode.And;
    
                    ////GROUP DESCRIPTION FOOTER ROW
                    AverageFunction gPerf = new AverageFunction();
                    gPerf.ResultPropertyName = "GCALC";
                    gPerf.SourcePropertyName = "GROSS_CALC";
    
                    AverageFunction nPerf = new AverageFunction();
                    nPerf.ResultPropertyName = "NCALC";
                    nPerf.SourcePropertyName = "NET_CALC";
    
                    StandardDeviationFunction sdvCal = new StandardDeviationFunction();
                    sdvCal.ResultPropertyName = "TCALDAYS";
                    sdvCal.SourcePropertyName = "TOTAL_CALENDAR_DAYS";
    
                    StandardDeviationFunction sdvBus = new StandardDeviationFunction();
                    sdvBus.ResultPropertyName = "TBUSDAYS";
                    sdvBus.SourcePropertyName = "TOTAL_BUSINESS_DAYS";
    
                    SumFunction ttlLate = new SumFunction();
                    ttlLate.ResultPropertyName = "GLATE";
                    ttlLate.SourcePropertyName = "GROSS_LATE_COUNT";
    
                    SumFunction ttlOntime = new SumFunction();
                    ttlOntime.ResultPropertyName = "NLATE";
                    ttlOntime.SourcePropertyName = "NET_LATE_COUNT";
    
                    SumFunction gOntime = new SumFunction();
                    gOntime.ResultPropertyName = "GONTIME";
                    gOntime.SourcePropertyName = "GROSS_CALC";
    
                    SumFunction nOntime = new SumFunction();
                    nOntime.ResultPropertyName = "NONTIME";
                    nOntime.SourcePropertyName = "NET_CALC";
    
                    dv.StatFunctions.Add(gPerf);
                    dv.StatFunctions.Add(nPerf);
                    dv.StatFunctions.Add(sdvCal);
                    dv.StatFunctions.Add(sdvBus);
                    dv.StatFunctions.Add(gOntime);
                    dv.StatFunctions.Add(nOntime);
                    dv.StatFunctions.Add(ttlLate);
                    dv.StatFunctions.Add(ttlOntime);
    
    Fawzi [Xceed]
    Member
    Post count: 722

    Hi,

    Stating from v6.2, we have added an “out of the box” group header that displays stats. You may refer to the DefaultHeadersFootersType property on GroupConfiguration topic on our documentation center for detailed information in this regard, at:

    http://forums.xceed.com/wp-content/documentation/xceed-datagrid-for-wpf/webframe.html#Xceed.Wpf.DataGrid~Xceed.Wpf.DataGrid.GroupConfiguration~DefaultHeadersFootersType.html

    You may also check the “Summaries & Statistics” sample, which comes along with the Xceed pacakge and can be found, by default, at the following path on your machine:

    C:\Xceed Samples\Xceed DataGrid for WPF v6.4\CSharp\SummariesAndStatistics

    It demonstrates how to create a statcell for every corresponding StatFunction defined on the DataGridCollectionView.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.