locked
pseudo XML data source RRS feed

  • Question

  • I am creating a mock-up of an user interface. I would normally populate the ListBox with an XML data source.

     But SilverLight (Blend) does not have a XML data source binding option). Is there an equivelenet method I could use to rapidly databind to an XML source (or something transformed into a CLR data source).

     

     

    Friday, July 4, 2008 1:38 PM

Answers

  • Unfortunately Silverlight doesn't have XmlDataProvider, and thus you can't write XPath in XAML. Also the syntax such as <TextBlock Text=”{Binding Path=Root.Element[Planet].Element[Orbit]}” /> is not supported. But you can always use LINQ to XML to build an object model, and then bind to the object model. Please refer to http://msdn.microsoft.com/en-us/library/cc189074(VS.95).aspx.

    Monday, July 7, 2008 1:07 AM

All replies

  • Hi,

    what does mean "XML data source"? Do you mean a control?

    Friday, July 4, 2008 2:16 PM
  • No I mean data binding to an xml source (which is supported in WPF and in Blend when one makes an WPF application). Silverlight seems to only have CLR data binding.

     

     

    Friday, July 4, 2008 5:49 PM
  • Unfortunately Silverlight doesn't have XmlDataProvider, and thus you can't write XPath in XAML. Also the syntax such as <TextBlock Text=”{Binding Path=Root.Element[Planet].Element[Orbit]}” /> is not supported. But you can always use LINQ to XML to build an object model, and then bind to the object model. Please refer to http://msdn.microsoft.com/en-us/library/cc189074(VS.95).aspx.

    Monday, July 7, 2008 1:07 AM
  • Thank you, that was indeed what I was looking for.

     

     

    Monday, July 7, 2008 10:08 AM