Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3160
How to bind to a property of a property??
posted

I have two classes that look like this:

class TBARule

{

   public Rule_Core Rule_Core {get; set;}

}

class Rule_Core

{

   public string RULE_NAME {get; set} 

}

I have a XamDataGrid that binds to a list of TBARule. 

In that grid, I need to bind a text box to the property TBARule.Rule_Core.RULE_NAME.

I tried making a property on TBARule with a getter that returned Rule_Core.RULE_NAME but that does not work.

I also tried setting the datacontext of the textbox to the Rule_Core property and binding to RULE_NAME as shown below.  It does not work:

 <code>

 

 

 

 

 

 

 

 

 

 

 

 

<

 

 

 

igDP:Field Name="Name" Width

="3*">

 

 

 

 

<igDP:Field.Settings

>

 

 

 

 

<igDP:FieldSettings AllowEdit

="False">

 

 

 

 

<igDP:FieldSettings.EditorStyle

>

 

 

 

 

<Style TargetType="{x:Type igEditors:XamTextEditor

}">

 

 

 

 

<Setter Property="Background" Value

="Transparent"/>

 

 

 

 

<Setter Property="DataContext" Value="{Binding Path=Rule_Core, Mode=TwoWay}"></Setter

>

 

 

 

 

<Setter Property="Text" Value="{Binding RULE_NAME}"></Setter

>

 

 

 

 

</Style

>

 

 

 

 

</igDP:FieldSettings.EditorStyle

>

 

 

 

 

</igDP:FieldSettings

>

 

 

 

 

</igDP:Field.Settings

>

 

 

 

 

</igDP:Field

>

</code>

 Thanks for any help!! 

Sam

  • 138253
    Verified Answer
    Offline posted

    Hello Sam,

    Thank you for your post. I have been looking into it and I created a sample project for you using the Data you have, but instead of Field used UnboundField, because it is used when you have a complex property. Please let me know if this helps you or you need further assistance on this matter. 

    Looking forward for your reply.