Home Forums WinForms controls Xceed Grid for WinForms How can I format a Date in the .TitleFormat %GROUPKEY% ??

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

    In one of my groups in the Grid the data is a Date. I was looking for a method of chaning the format of the date to suit what I am looking for.

    <i>
    Group workingGroup = new Group();
    workingGroup.GroupBy = “Working Date”;
    GroupManagerRow workingGMR = new GroupManagerRow();
    workingGroup.HeaderRows.Add(workingGMR);
    workingGMR.TitleFormat = “%GROUPKEY%”;
    gridControl1.GroupTemplates.Clear();
    gridControl1.GroupTemplates.Add(workingGroup);
    </i>

    If this was just a normal colum I don’t seem to have any problems with this as I can just set it to the correct column. (This code doesn’t seem to affect the HeaderRow.)

    <i>
    System.Globalization.DateTimeFormatInfo format = new System.Globalization.DateTimeFormatInfo();
    format.ShortDatePattern = “yyyy/MMM/dd”;
    gridControl1.Columns[“Working Date”].FormatSpecifier = “d”;
    gridControl1.Columns[“Working Date”].FormatProvider = format;
    </i>

    Is there an update command I need to execute in order for the hearder row to pickup on any column data formatting?

    Thanks in advance,
    Shawn

    Imported from legacy forums. Posted by Shawn (had 2724 views)

    User (Old forums)
    Member
    Post count: 23064

    You need to use the GroupTitle instead of the GroupKey when setting the TitleFormat property :

    workingGMR.TitleFormat = “%GroupTitle%”;

    Imported from legacy forums. Posted by André (had 270 views)

    User (Old forums)
    Member
    Post count: 23064

    Works well.. thanks..

    Imported from legacy forums. Posted by Shawn (had 3300 views)

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