Home Forums WinForms controls Xceed Grid for WinForms Possible error initializing SummaryCell in 3.9

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17486 |

    We just upgraded to Xceed Grid for .NET version 3.9 and are running it under VisualStudio 2010 (.NET 4.0)

    Adding a summary row to an existing grid does not work until we manually initialize each cell where we want a value to appear. That is, the summary cell contains no data unless we add the *last* line in the Designer code such as.

                 //
                // cellsummaryRow1OptionRequirement
                //
                this.cellsummaryRow1OptionRequirement.StatFunction = Xceed.Grid.StatFunction.Sum;
                this.cellsummaryRow1OptionRequirement.Tag = “”;
                this.cellsummaryRow1OptionRequirement.TitlePosition = Xceed.Grid.TitlePosition.PreferablyLeft;
                this.cellsummaryRow1OptionRequirement.Initialize(“OptionRequirement”); // MUST ADD THIS LINE TO GET A WORKING SUMMARY CELL!!!

    This used to work fine in our previous versions of Xceed Grid (3.6) & Visual Studio 2008 without the need to initialize.

    Can someone please confirm whether this is in fact a bug and whether this is the preferred solution? Thanks. 

    Imported from legacy forums. Posted by Ron (had 1112 views)

    User (Old forums)
    Member
    Post count: 23064

    btw, this solution is problematic because the initialize lines are lost every time the grid is touched and the designer code regenerated. If this is the preferred solution, is there some way so that we don’t have to keep readding the same lines?

    Imported from legacy forums. Posted by Ron (had 284 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Ron,

    The folowing is taken from our sample “StarterGrid” and is the right way to declare and initialize a SummaryRow:

    // The folowing line creates a SummaryRow which will be used

    // to display the average unit price (Unit Price) for the data rows

    // contained in each group.

    SummaryRow averageUnitPriceSumRow = new SummaryRow();

    SummaryRow defaultAverageUnitPrice = new SummaryRow();

    // Display the result of the average of the “UnitPrice” column through the SummaryRow.

    averageUnitPriceSumRow.TextFormat =

    “Average Unit Price: %AVG:UnitPrice format=c%”;

    defaultAverageUnitPrice.TextFormat =

    “Average Unit Price: %AVG:UnitPrice format=c%”;

    // The following line accesses the first group template used in the grid.

    // It adds the previously created SummaryRow to this group’s footer rows. Note: the

    // SummaryRow could have been added to the group’s footer rows by directly using the

    // “group” variable created above (group.FooterRows.Add…).

    starterGrid.GroupTemplates[ 0 ].FooterRows.Add( averageUnitPriceSumRow );

    // Add a running sum for the “UnitsInStock” column. This needs to be done after the

    // SummaryRow has been added to the grid’s GroupTemplates.

    SummaryCell cell = ( SummaryCell )averageUnitPriceSumRow.Cells[ “UnitsInStock” ];

    cell.StatFunction =

    StatFunction.Sum;

    cell.RunningStatGroupLevel = 0;

    cell.TitleFormat =

    “Total units in stock so far.”;

    // If there is not enough room to display the cell’s title to the right, don’t display it.

    cell.TitlePosition =

    TitlePosition.AlwaysRight;

    defaultGroup.FooterRows.Add( defaultAverageUnitPrice );

    Imported from legacy forums. Posted by Alain [Xceed] (had 188 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks, Alain, we’ll give it a shot.

    So we shouldn’t be using the designer to create a SummaryRow?

    Imported from legacy forums. Posted by Ron (had 1373 views)

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