Some Columns Don't Allow Grouping

2 posts, 0 answers
  1. StevenDale
    StevenDale avatar
    100 posts
    Member since:
    Apr 2007

    Posted 27 Apr 2009 Link to this post

    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: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}" />










    Billy Jacobs


  2. Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 28 Apr 2009 Link to this post

    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" 
        Title="Window1" Height="300" Width="300"
            <telerik:RadGridView Margin="-2,2,2,-2"  
                    <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}" /> 

    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.

    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.
Back to Top