Setting DisplayContent property

2 posts, 0 answers
  1. kishor
    kishor avatar
    1 posts
    Member since:
    Oct 2010

    Posted 07 Apr 2011 Link to this post

    I'm using "RadGridView" to display order data. I want to group the orders by order date and display group descriptor "MMM d" format.

    I have ObservableCollection<Orders> bound to grid.

    Orders has OrderDate and OrderDisplayDate.

     <telerik:RadGridView.GroupDescriptors>
                   <telerik:GroupDescriptor Member="OrderDate" SortDirection="Ascending"
                        DisplayContent="OrderDisplayDate" />
                </telerik:RadGridView.GroupDescriptors>

    OrderDate is DateTime of the order

    OrderDisplayDate does OrderDate.ToString(MMM d)

    The grid is grouped fine based on the order date but the group descriptor display order date as group header meaning it displays 04 / 16/ 2011 vs Apr 16. I don't see it is calling OrderDisplayDate at all.

    Any help is appreciated.
  2. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 08 Apr 2011 Link to this post

    Hi kishor,

     DisplayContent is used to represent the descriptor visually in the GridViewGroupPanel, not in the group header.

     What you can do is use the GroupHeaderTemplate property of RadGridView and bind to the group key with the StringFormat you need. The DataContext for the GroupHeaderTemplate is an instance of the GroupViewModel class. In your case, GroupHeaderTemplate can be a single TextBlock, whose Text property has a binding with path "GroupKey" and whatever StringFormat you need.

    Regards,
    Yavor Georgiev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top