Using GroupDescriptors in RadGridView

6 posts, 0 answers
  1. Triet Nguyen Cong
    Triet Nguyen Cong avatar
    78 posts
    Member since:
    Mar 2010

    Posted 01 Jun 2010 Link to this post

    Hi team,

    I'm having a problem with GroupDescriptors in RadGridView. I have a grid which have 2 columns are "First Name" and "Last Name", and I want to group by "First Name" column. I do like this:

    MainPage.xaml:

    <
    Controls:RadGridView Grid.Column="0" x:Name="lstView" AutoGenerateColumns="False" ScrollViewer.VerticalScrollBarVisibility="Auto" >


    <Controls:RadGridView.GroupDescriptors>

    <Data:GroupDescriptor Member="FirstName" >

    </Data:GroupDescriptor>

    </Controls:RadGridView.GroupDescriptors>


    <
    Controls:RadGridView.Columns>

    <Controls:GridViewDataColumn Header="First Name"

    DataMemberBinding="{Binding Path=FirstName}"/>

    <Controls:GridViewDataColumn Header="Last Name"

    DataMemberBinding="{Binding Path=LastName}"/>

    </Controls:RadGridView.Columns>

    </Controls:RadGridView>

    And code behind (MainPage.xaml.cs):

     

    using

     

    System.Collections.ObjectModel;

     

     

     

    using

     

    System.ComponentModel;

     

     

     

    using

     

    System.Windows;

     

     

     

    using

     

    System.Windows.Data;

     

     

     

    namespace

     

    SilverlightApplication28

     

    {

     

    public partial class MainPage : INotifyPropertyChanged

     

     

     

     

    {

     

    public event PropertyChangedEventHandler PropertyChanged;

     

     

    protected void NotifyPropertyChanged(string propertyName)

     

    {

     

    var propertyChanged = PropertyChanged;

     

     

    if ((propertyChanged != null))

     

    {

    propertyChanged(

    this, new PropertyChangedEventArgs(propertyName));

     

    }

    }

     

    private PagedCollectionView _listUsers;

     

     

    public PagedCollectionView ListUsers

     

    {

     

    get { return _listUsers; }

     

     

    set

     

     

     

     

    {

    _listUsers =

    value;

     

    NotifyPropertyChanged(

    "ListUsers");

     

    }

    }

     

    public MainPage()

     

    {

    InitializeComponent();

    Loaded+=MainPage_Loaded;

     

    }

     

    private void MainPage_Loaded(object sender, RoutedEventArgs e)

     

    {

     

    var user1 = new User("Nguyen", "Cuong");

     

     

    var user2 = new User("Nguyen", "Tu");

     

     

    var users = new ObservableCollection<User> { user1, user2 };

     

    ListUsers =

    new PagedCollectionView(users);

     

    lstView.ItemsSource = ListUsers;

    }

    }

    }

     

    But it doesn't work.
    Please help me !

    Thanks,
    Triet

     

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 01 Jun 2010 Link to this post

    Hi Triet Nguyen Cong,

     
    I have created a sample project with the exact same code as the one you have posted and everything works fine on my side. Please, take a look at it and if there is some misunderstanding with your requirements and expectations, do not hesitate to get back to us.


    Best wishes,
    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. Triet Nguyen Cong
    Triet Nguyen Cong avatar
    78 posts
    Member since:
    Mar 2010

    Posted 02 Jun 2010 Link to this post

    Thank you, Maya!

    Your code works well. It looks the same my code, but my program doesn't run. I found that you are using telerik 2010.1.0528.1040 version, and I'm using 2010.1.422.1030 version. Is there any diffirent between 2 versions? Or any reason make your code run and me is not.

    Thank you again,
    Triet
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 02 Jun 2010 Link to this post

    Hi Triet Nguyen Cong,

    We fixed a problem concerning the group descriptors. So, I would recommend to you to use our latest internal builds.  

    Best wishes,
    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.
  5. Triet Nguyen Cong
    Triet Nguyen Cong avatar
    78 posts
    Member since:
    Mar 2010

    Posted 03 Jun 2010 Link to this post

    I downloaded the latest internal build, and it works great. 

    Thanks for your support! 
  6. Bun
    Bun avatar
    2 posts
    Member since:
    Mar 2012

    Posted 13 Mar 2012 Link to this post

    Dear Telerik Team,

    For Triet Nguyen Cong , he wanna to group by FirstName only. But for me, I wanna group by FirstName and LastName as one column.

    So Do you have any solution?

    Thanks,
Back to Top