I have some aggregrate functions on my gridview like this
groupview = new QueryableCollectionView(MyListGrid.Items);
if (MyListGrid.GroupDescriptors.Count > 0)
MyListGrid.GroupDescriptors.Clear();
var descriptor = new GroupDescriptor() { Member = "Status" };
descriptor.AggregateFunctions.Add(new CountFunction());
this.MyListGrid.GroupDescriptors.Add(descriptor);
and I get the following exception at descriptor.AggregateFunctions.Add(new CountFunction());
{"Unable to cast object of type 'Telerik.Windows.Data.QueryableCollectionViewGroup' to type 'Telerik.Windows.Data.AggregateFunctionsGroup'."}
6 Answers, 1 is accepted
0
Hello,
Vlad
the Telerik team
Can you post the stack trace?
Regards,Vlad
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

Xaria D
Top achievements
Rank 1
answered on 12 Oct 2010, 10:46 AM
I am having problems after I changed to Q2 2010.
I placed a Breakpoint at groupview = new QueryableCollectionView(MyListGrid.Items);
and the debugger exits at
this.MyListGrid.GroupDescriptors.Add(descriptor);
the code is as below
private void LoadTreeViewData(int Id)
{
try
{
if (MyListGrid.Items.Count > 0 && Id== 1)
{
try
{
groupview = new QueryableCollectionView(MyListGrid.Items);
if (MyListGrid.GroupDescriptors.Count > 0)
MyListGrid.GroupDescriptors.Clear();
var descriptor = new GroupDescriptor() { Member = "Status" };
descriptor.AggregateFunctions.Add(new CountFunction());
this.MyListGrid.GroupDescriptors.Add(descriptor);
}
catch (Exception ex)
{
MessageBox.Show("LoadTreeViewData :" + ex.Message, "System Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
}
}
i do not get any exception, the debugger just exits and the UI is not updated at all.
I placed a Breakpoint at groupview = new QueryableCollectionView(MyListGrid.Items);
and the debugger exits at
this.MyListGrid.GroupDescriptors.Add(descriptor);
the code is as below
private void LoadTreeViewData(int Id)
{
try
{
if (MyListGrid.Items.Count > 0 && Id== 1)
{
try
{
groupview = new QueryableCollectionView(MyListGrid.Items);
if (MyListGrid.GroupDescriptors.Count > 0)
MyListGrid.GroupDescriptors.Clear();
var descriptor = new GroupDescriptor() { Member = "Status" };
descriptor.AggregateFunctions.Add(new CountFunction());
this.MyListGrid.GroupDescriptors.Add(descriptor);
}
catch (Exception ex)
{
MessageBox.Show("LoadTreeViewData :" + ex.Message, "System Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
}
}
i do not get any exception, the debugger just exits and the UI is not updated at all.
0
Hi,
Can you set Visual Studio to break on every exception to see what will be the result?
Regards,
Vlad
the Telerik team
Can you set Visual Studio to break on every exception to see what will be the result?
Regards,
Vlad
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

Xaria D
Top achievements
Rank 1
answered on 18 Oct 2010, 04:42 AM
Okay I have a method to handle Grid Grouping
void FodListGrid_Grouping(object sender, GridViewGroupingEventArgs e)
{
try
{
if (MyListGrid.GroupDescriptors.Count > 0)
this.MyListGrid.GroupDescriptors.Clear();
this.groupview.GroupDescriptors.Add(e.GroupDescriptor);
foreach (AggregateFunctionsGroup catgroup in groupview.Groups)
{
var groupresult = catgroup.GetAggregateResults(e.GroupDescriptor.AggregateFunctions);
switch (catgroup.Key.ToString())
{
and I get an exception at foreach (AggregateFunctionsGroup catgroup in groupview.Groups)
{"Unable to cast object of type 'Telerik.Windows.Data.QueryableCollectionViewGroup' to type 'Telerik.Windows.Data.AggregateFunctionsGroup'."}
I was using the above quote as suggested on this forum in my other post. But I was using Q3 2009 then and now I am using Q2 2010. So what should be done to resolve this? Typecasting does not work, is there a better way to handle this, Kindly let me know.
Thanks
void FodListGrid_Grouping(object sender, GridViewGroupingEventArgs e)
{
try
{
if (MyListGrid.GroupDescriptors.Count > 0)
this.MyListGrid.GroupDescriptors.Clear();
this.groupview.GroupDescriptors.Add(e.GroupDescriptor);
foreach (AggregateFunctionsGroup catgroup in groupview.Groups)
{
var groupresult = catgroup.GetAggregateResults(e.GroupDescriptor.AggregateFunctions);
switch (catgroup.Key.ToString())
{
and I get an exception at foreach (AggregateFunctionsGroup catgroup in groupview.Groups)
{"Unable to cast object of type 'Telerik.Windows.Data.QueryableCollectionViewGroup' to type 'Telerik.Windows.Data.AggregateFunctionsGroup'."}
I was using the above quote as suggested on this forum in my other post. But I was using Q3 2009 then and now I am using Q2 2010. So what should be done to resolve this? Typecasting does not work, is there a better way to handle this, Kindly let me know.
Thanks
0
Hello,
Vlad
the Telerik team
Have you checked the code in the demo I've posted? With the new version you cannot expect AggregateFunctionsGroup since these are QueryableCollectionViewGroup. Wither use "var" or change your foreach statement.
All the best,Vlad
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

Xaria D
Top achievements
Rank 1
answered on 18 Oct 2010, 08:44 AM
Hi Vlad,
Thanks, I got it working.
Thanks, I got it working.