morechilli
morechilli

Reputation: 9817

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?

Upvotes: 6

Views: 1500

Answers (1)

IgorM
IgorM

Reputation: 1068

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/

Upvotes: 2

Related Questions