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

Using GroupDescriptors in RadGridView

5 Answers 162 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Triet Nguyen Cong
Top achievements
Rank 2
Triet Nguyen Cong asked on 01 Jun 2010, 11:25 AM

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

 

5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 01 Jun 2010, 02:28 PM
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.
0
Triet Nguyen Cong
Top achievements
Rank 2
answered on 02 Jun 2010, 12:07 PM
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
0
Maya
Telerik team
answered on 02 Jun 2010, 01:29 PM
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.
0
Triet Nguyen Cong
Top achievements
Rank 2
answered on 03 Jun 2010, 11:44 AM
I downloaded the latest internal build, and it works great. 

Thanks for your support! 
0
Bun
Top achievements
Rank 1
answered on 13 Mar 2012, 05:19 PM
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,
Tags
GridView
Asked by
Triet Nguyen Cong
Top achievements
Rank 2
Answers by
Maya
Telerik team
Triet Nguyen Cong
Top achievements
Rank 2
Bun
Top achievements
Rank 1
Share this question
or