Home Forums WinForms controls Xceed Grid for WinForms GroupManagerRow.TitleFormat and overriding GetVariableText

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

    In advance I thank you for your help.

    I have a grid, which at the top level is grouped by date. I have a second level of grouping by Name. Under the second grouping, there are a given number of rows, which can be accounted for using the %DATAROWCOUNT% variable; however, I want to count with a little more granularity and place that information in the group row using the TitleFormat property of the GroupManagerRow.

    <b>Here is what the grid looks like:</b>
    <code>
    ————————————————————————————————–
    | A | B | C | D | E | F |
    ————————————————————————————————–
    – | Header Information from TitleFormat…. |
    ———————————————————————————————
    -|A: AAA Count 4 Rows |
    ——————————————————————————————-
    | AAA | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    | AAA | B123 | CDADC | BD | 0 | 123 |
    ——————————————————————————————
    | AAA | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    | AAA | B123 | CDADC | BD | 0 | 123 |
    ——————————————————————————————
    -|A: BBB Count 5 Rows |
    ——————————————————————————————-
    | BBB | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    | BBB | B123 | CDADC | BD | 0 | 123 |
    ——————————————————————————————
    | BBB | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    | BBB | B123 | CDADC | BD | 0 | 123 |
    ——————————————————————————————
    | BBB | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    </code>

    <b>I would like the Grid to look like this:</b>
    <code>
    ————————————————————————————————–
    | A | B | C | D | E | F |
    ————————————————————————————————–
    – | Header Information from TitleFormat…. |
    ———————————————————————————————
    -|A: AAA Count 4 Rows ED 2 Rows BD 2 Rows |
    ——————————————————————————————-
    | AAA | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    | AAA | B123 | CDADC | BD | 0 | 123 |
    ——————————————————————————————
    | AAA | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    | AAA | B123 | CDADC | BD | 0 | 123 |
    ——————————————————————————————
    -|A: BBB Count 5 Rows ED 3 Rows BD 2 Rows |
    ——————————————————————————————-
    | BBB | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    | BBB | B123 | CDADC | BD | 0 | 123 |
    ——————————————————————————————
    | BBB | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    | BBB | B123 | CDADC | BD | 0 | 123 |
    ——————————————————————————————
    | BBB | B123 | CDADC | ED | 0 | 123 |
    ——————————————————————————————
    </code>

    With the following code, I am able to get the count of every cell item that matches the criteria for the entire grid, but I am unable to get the individual groupings count to place in each separate group row. Any help would be greatly appreciated.
    <code>
    public class MyGroupManagerRow : Xceed.Grid.GroupManagerRow {
    public MyGroupManagerRow():base() {
    }
    public MyGroupManagerRow( MyGroupManagerRow template ):base( template ) {
    }

    protected override string GetVariableText( string variableName ) {
    if( base.GetVariableText( variableName ) == string.Empty ) {
    if( variableName == “Stuff” ) {
    int rowCount = 0;
    int ed = 0;
    int bd = 0;
    if (this.GridControl.Groups.Count > 0) {
    foreach (Group group in this.GridControl.Groups) {
    foreach (Xceed.Grid.DataRow row in group

    Imported from legacy forums. Posted by flatface (had 2965 views)

    User (Old forums)
    Member
    Post count: 23064

    Instead of <i>foreach(Group group in this.GridControl1.Groups)</i>, you should only use the Group this GroupManagerRow is part of. Like this:<pre>GroupBase group = this.ParentGroup;
    foreach(Xceed.Grid.DataRow row in group.GetSortedDataRows(true)) { … }</pre>

    Imported from legacy forums. Posted by Tommy (had 299 views)

    User (Old forums)
    Member
    Post count: 23064

    A GREAT BIG THANKS to you Tommy for such a quick reply! I will give it a try.

    Imported from legacy forums. Posted by flatface (had 344 views)

    User (Old forums)
    Member
    Post count: 23064

    Considering the number of posts that you reply, I want to thank you agian for taking the time and answering my post. You are obviously a generous person. I implemented your solution and it works perfectly. Thanks.

    Imported from legacy forums. Posted by flatface (had 3932 views)

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