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

Some Columns Don't Allow Grouping

1 Answer 33 Views
GridView
This is a migrated thread and some comments may be shown as answers.
StevenDale
Top achievements
Rank 2
StevenDale asked on 27 Apr 2009, 07:44 PM
I have a RadGridView that is bound to a list of Medication Objects.
A medication contains the following fields:
Drug - object                  Bound to Drug.Name
Dosage - string              Bound to Dosage
StartTime - DateTime     Bound to StartTime
EndTime - DateTime      Bound to EndTIme
Comments - String         Bound to Comments

When the control binds to my list, all of the fields are allowed to be grouped except for the Drug.Name. Is there a way to group this column?

Here is my XAML

 

 

<telerik:RadGridView Margin="-2,2,2,-2" AutoGenerateColumns="False" Name="radGridView1" ItemsSource="{Binding PatientMedications}">

 

 

 

<telerik:RadGridView.Columns>

 

 

 

<telerik:GridViewDataColumn HeaderText="Name" DataMemberBinding="{Binding Path=Drug_.Name}" UniqueName="{x:Null}"/>

 

 

 

<telerik:GridViewDataColumn HeaderText="Dosage" DataMemberBinding="{Binding Path=Dosage}" UniqueName="{x:Null}" />

 

 

 

<telerik:GridViewDataColumn HeaderText="Started" DataMemberBinding="{Binding Path=StartTime}" UniqueName="{x:Null}" />

 

 

 

<telerik:GridViewDataColumn HeaderText="Ended" DataMemberBinding="{Binding Path=EndTime}" UniqueName="{x:Null}" />

 

 

 

<telerik:GridViewDataColumn HeaderText="Comments" DataMemberBinding="{Binding Path=Comments}" UniqueName="{x:Null}" />

 

 

 

</telerik:RadGridView.Columns>

 

 

 

</telerik:RadGridView>

Thanks,

Billy Jacobs

 

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 28 Apr 2009, 09:43 AM
Hi Billy Jacobs,

In order to enable grouping over that column, you will need to specify its DataType in the following manner:

<Window x:Class="Ticket208384_GroupByCompositeObjectProperty.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:System="clr-namespace:System;assembly=mscorlib" 
    Title="Window1" Height="300" Width="300"
    <Grid> 
        <telerik:RadGridView Margin="-2,2,2,-2"  
                             AutoGenerateColumns="False"  
                             Name="radGridView1"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn HeaderText="Name" 
                        DataType="{x:Type System:String}" 
                        DataMemberBinding="{Binding Path=Drug.Name}" UniqueName="{x:Null}" /> 
                <telerik:GridViewDataColumn HeaderText="Dosage" 
                        DataMemberBinding="{Binding Path=Dosage}" UniqueName="{x:Null}" /> 
                <telerik:GridViewDataColumn HeaderText="Started" 
                        DataMemberBinding="{Binding Path=StartTime}" UniqueName="{x:Null}" /> 
                <telerik:GridViewDataColumn HeaderText="Ended" 
                        DataMemberBinding="{Binding Path=EndTime}" UniqueName="{x:Null}" /> 
                <telerik:GridViewDataColumn HeaderText="Comments" 
                        DataMemberBinding="{Binding Path=Comments}" UniqueName="{x:Null}" /> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
    </Grid> 
</Window> 
 

I have prepared and attached a small sample project that demonstrates that. Please examine it and do not hesitate to contact us if you have any other questions.

Greetings,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
StevenDale
Top achievements
Rank 2
Answers by
Rossen Hristov
Telerik team
Share this question
or