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
725
How can i bind parent dataItem property to child
posted

Hello, 

I have to use parent record item property to bind child property.

eg.

Parent Object  : Item1,Item2,Item3,ObservableCollection<Child> ChildCollection

Child Object   : CItem1,CItem2

Now at the time of child field binding i need parent Item to bind here.

like :

<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout Key="boxRow">
<igDP:Field Name="Item1" Label="Item1"/>
<igDP:Field Name="Item2" Label="Item2"/>
<igDP:Field Name="ChildCollection" />
</igDP:FieldLayout>
<igDP:FieldLayout>
<igDP:Field Name="CItem1" Label="CItem1"/>
<igDP:UnboundField Width="Auto" >
<igDP:UnboundField.Binding>
<MultiBinding Converter="{StaticResource converterKey}">
<Binding Path="CItem2"></Binding>
<Binding Path="???? -> want to bind Parent Item3"></Binding>
</MultiBinding>
</igDP:UnboundField.Binding>
</igDP:UnboundField>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>

Parents
  • 138253
    Verified Answer
    Offline posted

    Hello Adit,

    Thank you for your post. I have been looking into it and I can say that since the DataItem in the UnboundField is null you are not able to get the parent Record through this Binding, but you can create a Style for the Editor and get the value you need there. The UnboundField can be defined like this:

    <igDP:UnboundField >
        <igDP:UnboundField.Settings>
            <igDP:FieldSettings>
                <igDP:FieldSettings.EditorStyle>
                    <Style TargetType="{x:Type igEditors:XamTextEditor}">
                        <Setter Property="Value">
                            <Setter.Value>
                                <MultiBinding Converter="{StaticResource converterKey}">
                                    <Binding Path="DataItem.CItem2"></Binding>
                                    <Binding RelativeSource="{RelativeSource AncestorType={x:Type igDP:DataRecordPresenter}}" Path="Record.ParentDataRecord.DataItem.Item3"></Binding>
                                </MultiBinding>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </igDP:FieldSettings.EditorStyle>
            </igDP:FieldSettings>
        </igDP:UnboundField.Settings>
    </igDP:UnboundField>

     

    Please let me know if this helps you or you need further assistance on this matter.

    Looking forward for your reply.

Reply Children