Column Binding Problem

6 posts, 1 answers
  1. Celso
    Celso avatar
    4 posts
    Member since:
    Sep 2007

    Posted 12 Dec 2008 Link to this post

    Hi,

    I have two set of objects, that are related in the following way:

    public class MyObject1 
       private MyObject2 _o2 = new MyObject2() { Address = "CR" }; 
       public MyObject2 O2 
       { 
                get 
                { 
                    return _o2; 
                } 
                set 
                { 
                    _o2 = value; 
                } 
            } 
     
            public string Name 
            { 
                get
                set
            } 
        } 
     
        public class MyObject2 
        { 
            public string Address 
            { 
                get
                set
            } 
        } 
     


    And I am binding the following set of properties on the grid:

    <telerik:RadGridView Name="radGridView1" ItemsSource="{Binding}" AutoGenerateColumns="False"
                <telerik:RadGridView.Columns> 
                    <telerik:GridViewDataColumn UniqueName="Name" IsGroupable="True" IsReadOnly="False" IsFilterable="True" HeaderText="Name" DataMemberBinding="{Binding Name}" /> 
                    <telerik:GridViewDataColumn UniqueName="Address" IsGroupable="True" IsReadOnly="False" IsFilterable="True" DataMemberBinding="{Binding O2.Address}" HeaderText="Address" /> 
                </telerik:RadGridView.Columns> 
            </telerik:RadGridView> 

    But after doing this binding the column binded to O2.Addres can´t be modified, grouped, filter. So I will like to know if this can be performed in some way.

    Thanks







  2. Answer
    Dimitar Dobrev
    Admin
    Dimitar Dobrev avatar
    44 posts

    Posted 15 Dec 2008 Link to this post

    Hello Celso,

    You have stumbled upon a problem that appears to be a glitch in the control. We have logged it in our To-Do list and we will start looking into it right away.

    As a workaround I suggest that you use the DataMemberPath instead of the DataMemeberBinding by simply setting the property path for the second column. You will also need to specify the data-type of the second column and make the binding mode of the first column two-way if you need editing:


    <telerik:RadGridView Name="radGridView1" ItemsSource="{Binding}" AutoGenerateColumns="False"
        <telerik:RadGridView.Columns> 
            <telerik:GridViewDataColumn UniqueName="Name" HeaderText="Name" DataMemberBinding="{Binding Name, Mode=TwoWay}" /> 
            <telerik:GridViewDataColumn UniqueName="Address" DataMemberPath="O2.Address" DataType="{x:Type system:String}" HeaderText="Address" /> 
        </telerik:RadGridView.Columns> 
    </telerik:RadGridView> 

    If you encounter other issues, we will greatly appreciate your feedback.

    Your Telerik points have been updated for your involvement.

    Regards,
    Dimitar Dobrev,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Sebastian Talamoni
    Sebastian Talamoni avatar
    32 posts
    Member since:
    Mar 2008

    Posted 18 Feb 2009 Link to this post

    Exactly.  I am experiencing exactly the same problem.

    Normally in our Architecture we have View objects and nested we have the real domain objects which are normally the context for the databinding..

    Using your trick/workaround works fine.
     The only disadvantage seems to be that the datatype is "required". 

    Are there any other disadvantage of using DataMemberPath ?
    Is this problem already fixed for next release?

  5. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 20 Feb 2009 Link to this post

    Hi Sebastian Talamoni,

    The issues will be resolved in the upcoming release.

    Regards,
    Milan
    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. Dogu Tumerdem
    Dogu Tumerdem avatar
    39 posts
    Member since:
    Sep 2006

    Posted 06 Mar 2009 Link to this post

    if you use UniqueName for a column. It works fine with both DataMemberPath and DataMemeberBinding.

    dogu tumerdem

  7. Celso
    Celso avatar
    4 posts
    Member since:
    Sep 2007

    Posted 06 Mar 2009 Link to this post

    Hi Dimitar Dobrev

    Thanks for your help!... I will be awaiting for next releases

    Regards,

    Celso
Back to Top
UI for WPF is Visual Studio 2017 Ready