使用 WPF 转换器将 xpath 节点存在转换为可见/隐藏/折叠
我已经成功地使用转换器将 WPF 中的布尔值转换为适当的属性,例如隐藏/折叠/可见以隐藏和显示控件。
我想使用 xpath 节点的存在来实现同样的事情 - 您在 XSLT 中测试的路径类型,例如:
如果节点存在,我希望转换器输出“可见”,如果不存在“隐藏”或“折叠”。
有人有什么想法吗?
I've been successfully using Converters to convert boolean values in WPF to an appropriate property e.g. Hidden/Collapsed/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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个转换器,它将 XPath 查询作为 转换器参数。
更多信息。
我认为我们无法提供更多 信息除了为您编写代码之外,还可以做其他事情:)
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 :)