开发者

Using WPF converters to translate xpath node existence to Visible/Hidden/Collapsed

开发者 https://www.devze.com 2023-02-25 05:47 出处:网络
I\'ve been successfully using Converters to convert boolean values in WPF to an appropriate property e.g. Hidden/Collapse开发者_开发问答d/Visible for hiding and showing a control.

I've been successfully using Converters to convert boolean values in WPF to an appropriate property e.g. Hidden/Collapse开发者_开发问答d/Visible for hiding and showing a control.

I'd like to achieve the same thing using the existence of an xpath node- the sort of path you'd test for in XSLT with something like:

<xsl:if test="/SomeNode/Exists"></xsl:if>

If the node exists, I want the converter to output "Visible" and if not "Hidden" or "Collapsed".

Anyone have any ideas?


Create a converter, which will take the XPath query as ConverterParameter.

Some more info.

I don't think there is much more we can do aside from writing the code for you :)

0

精彩评论

暂无评论...
验证码 换一张
取 消