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

Navigateable Properties in GridCell

4 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nils
Top achievements
Rank 1
Nils asked on 07 Aug 2009, 01:41 PM
Hi.
Small problem:
Imagine a class setup of:
public class DisplayData 
   public string Name { getset; } 
   public SomeOtherClass Prop { getset; } 
 
public class SomeOtherClass  
   public string OtherName { getset; } 

Now I have an ObservableCollection<DisplayData> to display in my Grid.
Problem is the following setup does no display SomeOtherClass nicely (how should it...)
<telerik:GridViewDataColumn  
     Header="Name" 
     DataMemberBinding="{Binding Path=Name, Mode=OneWay}" 
     Width="2*" 
     IsReadOnly="True"/> 
<telerik:GridViewDataColumn  
     Header="Other" 
     DataMemberBinding="{Binding Path=Prop, Mode=OneWay}" 
     Width="3*" 
     IsReadOnly="True"/> 

If I change the second column like this:
<telerik:GridViewDataColumn   
     Header="Name"  
     DataMemberBinding="{Binding Path=Name, Mode=OneWay}"  
     Width="2*"  
     IsReadOnly="True"/>  
<telerik:GridViewDataColumn   
     Header="Other"  
     DataMemberBinding="{Binding Path=Prop.OtherName, Mode=OneWay}"  
     Width="3*"  
     IsReadOnly="True"/>  

All displays fine. However I loose the Ability to Filter/Group the second column.
I am searching for something like:
<telerik:GridViewDataColumn    
     Header="Name"   
     DataMemberBinding="{Binding Path=Name, Mode=OneWay}"   
     Width="2*"   
     IsReadOnly="True"/>   
<telerik:GridViewDataColumn    
     Header="Other"   
     DataMemberBinding="{Binding Path=Prop, Mode=OneWay}" 
     DisplayMemberPath="OtherName"   
     Width="3*"   
     IsReadOnly="True"/>   

And I can't seem to find any solution..

I seem to walking in the dark here.. so could someone please enlighten me ?

Yours,
Nils

4 Answers, 1 is accepted

Sort by
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 10 Aug 2009, 12:54 PM
Hello Nils,

According to me this code snippet is the correct way to display data:

<telerik:GridViewDataColumn    
     Header="Other"   
     DataMemberBinding="{Binding Path=Prop.OtherName, Mode=OneWay}"   
     Width="3*"   
     IsReadOnly="True"/> 

About missing filtering and grouping feature, this is a known issue. The problem is that our control does not resolve data type from nested properties correctly. You can work around this by setting DataType property for the GridViewDataColumn:

DataType="sys:String" 

Hope this helps.

Best wishes,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Nils
Top achievements
Rank 1
answered on 10 Aug 2009, 03:47 PM
Works like charm. Thanks.

A little OT here, but I'd prefer writing
DataType="{x:Type sys:String}"  

Is there any significant difference ?

Nils


0
Nedyalko Nikolov
Telerik team
answered on 11 Aug 2009, 03:07 PM
Hi Nils,

For WPF there is no difference at all. I've used this syntax because it's applicable for Silverlight too.

Regards,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Nils
Top achievements
Rank 1
answered on 11 Aug 2009, 03:08 PM
ok. Thanks.
Tags
GridView
Asked by
Nils
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Nils
Top achievements
Rank 1
Share this question
or