English 中文(简体)
如何在SilverLight/Windows Phone中绑定Xml?
原标题:How do you bind to Xml in SilverLight/Windows Phone?

我正试图在Windows Phone应用程序中使用Linq到Xml和Xaml数据绑定,但没有成功,请参阅这个例子

我有一些Xaml,看起来像这样:

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

DataContextXDocument<;图像>;someuri</图像>。然而,这并没有像我得到的那样通过解析阶段:

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

这种绑定在Silverlight中是不可能的,还是我只是缺少了什么?

问题回答

创建您自己的对象,用页面所需的属性包装XML文档,并将其用于数据绑定。

绑定不够智能,无法以您尝试的方式处理集合。





相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...