views:

27

answers:

1

I am trying to use Linq to Xml and Xaml data binding in a Windows Phone app with no luck, following this example.

I've got some Xaml that looks like this:

    <Image 
           Source="{Binding Path=Element[image].Value, Converter={StaticResource UriBitmapConverter}}" 
           Grid.Column="2" MaxWidth="75" HorizontalAlignment="Right" VerticalAlignment="Top"/>

The DataContext is an XDocument <image>someuri</image>. However this doesn't make it past the parsing stage as I get:

Additional information: Invalid attribute value
{Binding Path=Element[image].Value, Converter={StaticResource UriBitmapConverter}} for property 

Is this sort of binding not possible in Silverlight or am I just missing something?

A: 

Create your own object that wraps your XML document with the required properties needed by your page and use that for databinding.

Binding isn't smart enough to work with collections in the way you were trying.

Matt Lacey
The binding above works in wpf (the linked article shows an example on MSDN)
dkackman
@ckackman Your above link is to the help file installed on your local machine. What is the equivalent online?
Matt Lacey