注释掉 XML
考虑一下这段 XML:
<ListBox x:Name="pictureBox"
ItemsSource="{Binding}"
MouseDoubleClick="item_DoubleClick"
>
有没有办法注释掉 MouseDoubleClick="item_DoubleClick"
?这次尝试失败了:
<ListBox x:Name="pictureBox"
ItemsSource="{Binding}"
<!-- MouseDoubleClick="item_DoubleClick"-->
>
Consider this piece of XML:
<ListBox x:Name="pictureBox"
ItemsSource="{Binding}"
MouseDoubleClick="item_DoubleClick"
>
Is there any way to comment out MouseDoubleClick="item_DoubleClick"
? This attempt fails:
<ListBox x:Name="pictureBox"
ItemsSource="{Binding}"
<!-- MouseDoubleClick="item_DoubleClick"-->
>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以注释掉整个元素,这将起作用,并在其下方放置不带该属性的修改版本。
You could just comment out the whole element, which would work, and underneath it put the modified version without that attribute.
不,这不是你必须删除它。元素声明内不能有注释。由于附加的“<”,解析器根本无法解析该 XML。在 ListBox 元素的 open 声明内签名。
No it's not you'll have to remove it. You cannot have comments inside the declaration of an Element. It would not be possible for the parser to parse this XML at all because of the additional "<" sign inside the open declaration of ListBox Element.