Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Store Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems.

Go Back   Vista Forums > Vista technology newsgroups > Avalon

passing multiple XML nodes to a binding converter

Reply
 
Thread Tools Display Modes
Old 03-12-2008   #1 (permalink)
Robin Senior
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
  Reply With Quote

Reply

Thread Tools
Display Modes









Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46