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 nested property?
posted

I found a post with the same question as mine however the links showing an example dont work:

http://blogs.infragistics.com/forums/p/10555/201363.aspx

 

I am binding to a class called Auction wich contains a property called Security.

Security is itself a class, with a property called StreetDesc.  Here is my XAML

 <igDP:UnboundField Name="StreetDesc" Label="Security Description">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings>
                                    <igDP:FieldSettings.CellValuePresenterStyle>
                                        <Style TargetType="igDP:CellValuePresenter">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate>
                                                        <TextBlock DataContext="{Binding Security}" Text="{Binding StreetDesc}"></TextBlock>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </igDP:FieldSettings.CellValuePresenterStyle>
                                </igDP:FieldSettings>
                               
                            </igDP:Field.Settings>
                        </igDP:UnboundField>

  • 3160
    Verified Answer
    posted

    Nevermind I got it.  Needed to add Dataitem to the Datacontext:

    <TextBlock DataContext="{Binding DataItem.Security}" Text="{Binding StreetDesc}"></TextBlock>