This is a migrated thread and some comments may be shown as answers.

Setting DisplayContent property

1 Answer 230 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
kishor
Top achievements
Rank 1
kishor asked on 07 Apr 2011, 10:26 PM
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.

1 Answer, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 08 Apr 2011, 06:04 AM
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
Tags
GridView
Asked by
kishor
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Share this question
or