![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest
Posts: n/a
| passing multiple XML nodes to a binding converter Hi, I'm looking to implement something similar to an example by Bea Costa ( http://www.beacosta.com/blog/?p=35 ), but using an XML data source instead of a C# data model. Image my XML data source looking like this: <?xml version="1.0" encoding="UTF-8"?> <points> <point x="275" y="100" >A</point> <point x="375" y="200" >B</point> <point x="275" y="300" >C</point> <point x="175" y="200" >D</point> </points> In Bea's example, she binds to the C# data model like so: <Polygon Fill="#CD5C5C" Points="{Binding Source={StaticResource src}, Path=Points, Converter={StaticResource converter}}"/> I assumed I would be easily able to switch it to XML by defining my XmlDataProvider (with key="pts") and bind to it as such: <Polygon Fill="#CD5C5C" Points="{Binding Source={StaticResource pts}, XPath=points, Converter={StaticResource converter}}"/> However, this doesn't work. The value object passed to the converter appears as the string "ABCD". How can I get it to pass the converter a collection of point nodes instead of a concatenated list of the nodes content? I've been told to add "path=InnerXml" to the binding and then parse the resulting XML, but this strikes me as quite inelegant. Any ideas? Cheers, -robin |
|
|
| |