Grouping shows wrong name in header

2 posts, 0 answers
  1. Sodi We
    Sodi We avatar
    160 posts
    Member since:
    Apr 2010

    Posted 09 Aug 2010 Link to this post

    Hello,

    I have a list of Employees that is set as the ItemsSource for a RadGridView. The headers of each column are determined by the metadata defined on the EmployeeEntity. This way the column headers are always shown in the right language for the user. This works as expected:

    Employee:
    [MetadataTypeAttribute(typeof(Employee.EmployeeMetadata))]
        public partial class Employee
        {
           internal sealed class EmployeeMetadata
            {
                // Metadata classes are not meant to be instantiated.
                private EmployeeMetadata()
                {
                }
     
                [Display(ResourceType = typeof(EmployeeResources), Name = "NameDisplay")]
                public string Name{ get; set; }
     
                [Display(ResourceType = typeof(EmployeeResources), Name = "CategoryDisplay")]
                public string EmployeeCategory{ get; set; }
       }
    }

    XAML:
    <telerik:RadGridView x:Name="empList" ItemsSource="{Binding Employees}" >
       <telerik:RadGridView.Columns>
          <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" />
          <telerik:GridViewDataColumn DataMemberBinding="{Binding EmployeeCategory}"/>
       </telerik:RadGridView.Columns>
       <telerik:RadGridView.GroupDescriptors>
          <telerik:GroupDescriptor Member="EmployeeCategory" />
       </telerik:RadGridView.GroupDescriptors>
    </telerik:RadGridView>

    This shows fore example as the headers for the datacolumns: "Naam" and "MedewerkersCategorie", because that is the way "NameDisplay" and "CategoryDisplay" are defined in the resources file.

    The problem is when I define groupîng like I did in the example, the group header simply shows "EmployeeCategory" and not "MedewerkersCategorie". If I however not group programmatically but via the user interface, the correct header name is shown.

    I've searched the forums and the only workable solution they propose is to catch the grouping event of the grid, and whenever the name of the column to group upon is equal to "EmployeeCategory" return a string from the resources file.

    What is the correct way to solve this situation?

    Thank you,
    Sodi We
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 11 Aug 2010 Link to this post

    Hello Sodi We,

    The workaround with handling the Grouping event is quite correct. You may take a look at this forum thread for a reference. 

    Regards,
    Maya
    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