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

[Solved] GridViewHeaderMenu fails in Q3 2010 for GridViewComboBoxColumn

3 Answers 52 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Scott Lance
Top achievements
Rank 1
Scott Lance asked on 11 Nov 2010, 05:13 PM
I updated the GridViewHeaderMenu from "Header Context Menu" at demos.telerik.com after updating project to Q3 2010.  Everything seems to be working fine except for "Group By" for GridViewComboBoxColumn.  There is a "Object reference not set to an instance of an object." error at the end of void OnMenuItemClick(object sender, RoutedEventArgs e)

xaml:

 

<

 

 

telerik:GridViewComboBoxColumn UniqueName="Type" Header="Form Type" DataMemberBinding="{Binding task.Type}" SelectedValueMemberPath="DataValue" DisplayMemberPath="TextValue" HeaderTextAlignment="Center" IsReadOnly="True">

 

 

 

 


Stack Trace:

   at Telerik.Windows.Data.TypeExtensions.DefaultValue(Type type)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.DefaltValueExpression(Type type)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName, Type memberType)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName, Type memberType, Boolean liftMemberAccessToNull)
   at Telerik.Windows.Data.Expressions.PropertyAccessExpressionBuilder.CreateMemberAccessExpressionOverride()
   at Telerik.Windows.Data.Expressions.MemberAccessExpressionBuilderBase.CreateMemberAccessExpression()
   at Telerik.Windows.Data.GroupDescriptor.CreateGroupKeyExpression(ParameterExpression parameterExpression)
   at Telerik.Windows.Data.GroupDescriptorBase.CreateGroupKeyExpression(Expression itemExpression)
   at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateGroupKeySelectorExpression()
   at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.get_GroupKeySelectorExpression()
   at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilderBase.CreateQuery()
   at Telerik.Windows.Data.Expressions.GroupDescriptorCollectionExpressionBuilder.CreateQuery()

 

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 12 Nov 2010, 03:18 PM
Hello Scott Lance,

I think I have spotted the cause :
In the code of the GridViewHeaderMenu , there is a line :

newDescriptor.Member = column.UniqueName;


This code asumes the member and the column name are the same .

In your code  there is : UniqueName="Type" and DataMemberBinding="{Binding task.Type}"
So when grouping a new GroupDescriptor is created with member"Type" instead of "task.type".

This is the reason for the exception to be thrown.

Let me know in case  you need further assistance.

Sincerey ,
Pavel Pavlov
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
Scott Lance
Top achievements
Rank 1
answered on 17 Nov 2010, 05:34 PM

Pavel,

Thanks, that was the issue. 

Instead of changing unqiue name to binding path i change the code in the GriveViewHeaderMenu

 

newDescriptor.Member = (column

 

as GridViewBoundColumnBase).DataMemberBinding.Path.Path;

It seems to work fine, but would this cause conflicts down the road?

 

0
Pavel Pavlov
Telerik team
answered on 18 Nov 2010, 12:02 PM
Hello Scott Lance,

Nice to hear the issue was solved. And about your code - it is just OK . I do not expect any problems with this approach .

Kind regards,
Pavel Pavlov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Scott Lance
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Scott Lance
Top achievements
Rank 1
Share this question
or