I have a radgridview with a bunch of columns. Each column has defined how to group and sort.
For instance:
- The data: MeetingDate is a of a custom type, which has a Tostring()-override that returns the datetime as date only (and implements IComparable<T>, IEquatable<T>
- GroupHeaderTemplate: Writes the date if there is one. Writes "None" otherwise
<
telerik:GridViewDataColumn
x:Name
=
"_meetingDateColumn"
IsReadOnly
=
"True"
Header
=
"Meeting date"
DataMemberBinding
=
"{Binding MeetingDate.TheDateTime, UpdateSourceTrigger=PropertyChanged}"
GroupHeaderTemplate
=
"{StaticResource GridDateColumnGroupHeaderTemplate}"
Width
=
"SizeToCells"
GroupMemberPath
=
"MeetingDate"
>
<
telerik:GridViewDataColumn.HeaderCellStyle
>
<
Style
TargetType
=
"telerik:GridViewHeaderCell"
>
<
Setter
Property
=
"ToolTipService.ToolTip"
Value
=
"Date when meeting is taking place"
/>
<
Setter
Property
=
"ToolTipService.ShowDuration"
Value
=
"{x:Static Member=system:Int32.MaxValue}"
/>
</
Style
>
</
telerik:GridViewDataColumn.HeaderCellStyle
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
TextBlock
VerticalAlignment
=
"Top"
Text
=
"{Binding MeetingDate.TheDateTime, StringFormat={}{0:g}}"
ToolTipService.Placement
=
"Center"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
I have around 20 columns, some are dates like the one above. One is industry, which groups by the category (http://ec.europa.eu/competition/mergers/cases/index/nace_all.html) but the column sorts by the entire industry name. Others are completely different - most have special handling of grouping and sorting.
The user is supposed to play around with grouping and sorting to find interesting stuff. However - in addition - I would like to provide a few preset options, which the user should be able to choose in a drop down and have the grid re-arrange itself accordingly.
I would hate to implement all 20 grouping and sorting again - is there any way I can reuse the defination of sort and group from the columns in the gridview - and apply them to the radgridview group panel programatically ?
Thanks,