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
255
Binding UnboundField like an Image to a Converter
posted

Hello,

I have the next problem. I want to indicate to the image the source of it depending some values of the record. In the first Converter (ConvFoto), i get the row, but i can't no modify the source of the image. However, in the second converter (ConvFotoDos), i can modify the source of the image, but i can not get the row source.

                        <igDP:UnboundField Label="Photo"  Name="ImageUri" Converter="{StaticResource ConvFoto}">
                            <igDP:UnboundField.Settings>
                                <igDP:FieldSettings AllowResize="False" CellWidth="30" LabelWidth="20" CellMaxHeight="20" >
                                    <igDP:FieldSettings.CellValuePresenterStyle >
                                        <Style TargetType="{x:Type igDP:CellValuePresenter}">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate>
                                                            <Image Source="{Binding   RelativeSource ={RelativeSource TemplatedParent}, 

                                                                                              Converter={StaticResource ConvFotoDos}}" >
                                                            </Image>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </igDP:FieldSettings.CellValuePresenterStyle>
                                </igDP:FieldSettings>
                            </igDP:UnboundField.Settings>
                        </igDP:UnboundField>

What I have to do to in the second convert get the info of the row?

Regards,

  • 138253
    Offline posted

    Hello Igor,

     

    I am just checking if you got this worked out or you still require any assistance or clarification on the matter.

  • 138253
    Offline posted

    Hello Igor,

    Thank you for your post. I have been looking into it and I can suggest you use the second Converter with a little modification. You can use RelativeSource in order to get the row data. It could look like this:

    <igDP:UnboundField Label="Photo" Name="ImageUri">
        <igDP:UnboundField.Settings>
            <igDP:FieldSettings AllowResize="False" CellWidth="30" LabelWidth="20" CellMaxHeight="20" >
                <igDP:FieldSettings.CellValuePresenterStyle >
                    <Style TargetType="{x:Type igDP:CellValuePresenter}">
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Image Source="{Binding 
                                                RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordPresenter}}, 
                                                Path=DataRecord,
                                                Converter={StaticResource ConvFotoDos}}">
                                    </Image>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </igDP:FieldSettings.CellValuePresenterStyle>
            </igDP:FieldSettings>
        </igDP:UnboundField.Settings>
    </igDP:UnboundField>

     

    Please let me know if you need further clarifications on this matter.

    Looking forward for your reply.