Navigateable Properties in GridCell

5 posts, 1 answers
  1. Nils
    Nils avatar
    46 posts
    Member since:
    Jul 2009

    Posted 07 Aug 2009 Link to this post

    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
  2. Answer
    Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 10 Aug 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Nils
    Nils avatar
    46 posts
    Member since:
    Jul 2009

    Posted 10 Aug 2009 Link to this post

    Works like charm. Thanks.

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

    Is there any significant difference ?

    Nils


  5. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 11 Aug 2009 Link to this post

    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.
  6. Nils
    Nils avatar
    46 posts
    Member since:
    Jul 2009

    Posted 11 Aug 2009 Link to this post

    ok. Thanks.
Back to Top
UI for WPF is Visual Studio 2017 Ready