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"/>
T开发者_运维问答he 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?
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.
精彩评论