Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you bind in xaml to a dynamic xpath?

I have a list box that displays items based on an XPath query.

This XPath query changes depending on the user's selection elsewhere in the GUI. The XPath always refers to the same document.

At the moment, I use some C# code behind to change the binding of the control to a new XPath expression.

I'd like instead to bind in XAML to an XPath, then change the value of that XPath as required.

How would I do that?

like image 262
morechilli Avatar asked Sep 19 '08 08:09

morechilli


1 Answers

I think that you're trying to over complicate the problem. But have you thought about allocating the XPath to a dynamic resource:

<....   ={Binding XPath={DynamicResource:res resource-name}} ... />

The best place to read about all-binding is Beatriz's blog: http://www.beacosta.com/blog/

like image 68
IgorM Avatar answered Nov 15 '22 06:11

IgorM