GroupDescriptor custom DataFormatString

3 posts, 1 answers
  1. Fernan
    Fernan avatar
    15 posts
    Member since:
    May 2010

    Posted 26 Feb Link to this post


    I have a GridView for a DesktopAlert. It is like the example in your demos. 

    For the grouping by email received datetime I have used the same example: 


    var dateGroupDescriptor = new Telerik.Windows.Data.GroupDescriptor<Message, DateTime, DateTime>();
               dateGroupDescriptor.GroupingExpression = email => email.Received.Value.Date;
               var dateSortDescriptor = new SortDescriptor<Message, DateTime>();
               dateSortDescriptor.SortingExpression = item => item.Received.Value;
               dateSortDescriptor.SortDirection = System.ComponentModel.ListSortDirection.Descending;


    It works succesfull, however the format of the group header is "mm/dd/yyyy" and I need other date formart. 

    How do I change the date format string?



  2. Answer
    Stefan Nenchev
    Stefan Nenchev avatar
    237 posts

    Posted 29 Feb Link to this post


    The FormatString of the group can be set for the column you are performing the group on. You can use the GroupHeaderFormatString property of the column:

    this.clubsGrid.Columns["Established"].GroupHeaderFormatString = "dd-MM-yyyy";

    GroupDescriptor gd = new GroupDescriptor()
    Member = "Established",
            SortDirection = ListSortDirection.Descending


    When performing grouping operation over the "Established" column, the aforementioned format string will be applied for the Group Header. Would it be possible to set the Grouping this way? I have also attached a sample project which you can check.

    Stefan Nenchev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
  4. Fernan
    Fernan avatar
    15 posts
    Member since:
    May 2010

    Posted 29 Feb in reply to Stefan Nenchev Link to this post

    Thanks! It works for me
Back to Top