wpf telerik user control databinding problem

2 posts, 0 answers
  1. OLeksiy
    OLeksiy avatar
    1 posts
    Member since:
    Jun 2013

    Posted 13 Jun 2013 Link to this post

    Hi I am trying to create teleric propertygrid-based user control that contains a multiline textbox, but I can't configure data-bindig.
    exactly i can't call set for property
    public UserControl1()
           this.DataContext = this;
           Rad.Item = new object() { };
       public string longStringVal_
               return (string)GetValue(longStringVal);
               SetValue(longStringVal, value);
    public static readonly DependencyProperty longStringVal =

        <telerik:RadPropertyGrid x:Name="Rad" >
                <telerik:PropertyDefinition DisplayName="LongStr" OrderIndex="-1" >
                            <TextBox MinLines="3" MaxLines="3" 
                                     Text="{Binding Path = longStringVal_, Mode=TwoWay}"                                    
    Any help is much appreciated!

  2. Ivan Ivanov
    Ivan Ivanov avatar
    1216 posts

    Posted 18 Jun 2013 Link to this post


    The editors' DataContext is their parent PropertyGrid's Item. As the Object type does not have a longStringVal_ property your code results in a BindingExpressionPath error. The longStringVal_ is a member of the UserControl class, so that you should be using RelativeSource AncestorType binding to make it work.

    Ivan Ivanov

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top