views:

141

answers:

0

Hey

I have an XmlDataProvider that refers to an XML file and a specific node, and a TextBlock which it's Text property is bind to an element. So far so good, everything works and I can see the element's value in the TextBlock.

What I'm trying to do is to forward that value into a method that will return me a string value that I have to pass into an Image control.

So I added an ObjectDataProvider that is bind to a method and a OneWayToSource binding to the TextBlock, and finally made sure that the Image control's Source property would be bind to the ObjectDataProvider.

But for some reason this is not working propertly, I've been trying to figure it out for few hours without any success.

Please your advice.

    <XmlDataProvider
        x:Key="xmlProvider"
        XPath="/Posts/Post[1]"
        IsAsynchronous="False"
        IsInitialLoadEnabled="True"
        Source="C:\posts.xml"
    />
    <ObjectDataProvider ObjectType="{x:Type local:SPProfileQuery}" MethodName="GetPictureByDisplayName" x:Key="odp1">
        <ObjectDataProvider.MethodParameters>
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>

            <TextBlock x:Name="tbPostUserName">
                <TextBlock.Text>
                    <MultiBinding StringFormat="{}{0}" UpdateSourceTrigger="PropertyChanged">
                        <Binding Source="{StaticResource xmlProvider}" XPath="Author" Mode="OneWay"></Binding>
                        <Binding Source="{StaticResource odp1}" Path="MethodParameters[0]" BindsDirectlyToSource="True" Mode="OneWayToSource" UpdateSourceTrigger="PropertyChanged"/>
                    </MultiBinding>
                </TextBlock.Text>
            </TextBlock>