Joa*_*nge 73 .net c# wpf xaml comments
我使用这种语法,因为我发现在线,但它抛出一个错误:
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!-- Cool comment -->
xmlns:System="clr-namespace:System;assembly=mscorlib"
Run Code Online (Sandbox Code Playgroud)
'名称不能以'<'字符开头,十六进制值0x3C.第4行,第5位.' XML无效.
Dan*_*n J 80
我假设那些XAML名称空间声明在控件的父标记中?您不能将注释放在另一个标记内.除此之外,您使用的语法是正确的.
<UserControl xmlns="...">
<!-- Here's a valid comment. Notice it's outside the <UserControl> tag's braces -->
[..snip..]
</UserControl>
Run Code Online (Sandbox Code Playgroud)
小智 30
Laurent Bugnion找到了一个很好的解决方案,它看起来像这样:
<UserControl xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:comment="Tag to add comments"
mc:Ignorable="d comment" d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Button Width="100"
comment:Width="example comment on Width, will be ignored......">
</Button>
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
这是链接:http: //blog.galasoft.ch/posts/2010/02/quick-tip-commenting-out-properties-in-xaml/
链接上的评论者为忽略前缀提供了额外的字符,而不是突出显示:
mc:Ignorable=”ØignoreØ”
Run Code Online (Sandbox Code Playgroud)
Lom*_*man 25
您不能在xml标记中插入注释.
坏
<Window xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!-- Cool comment -->
xmlns:System="clr-namespace:System;assembly=mscorlib">
Run Code Online (Sandbox Code Playgroud)
好
<Window xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib">
<!-- Cool comment -->
Run Code Online (Sandbox Code Playgroud)
Jak*_*kša 10
只是一个提示:
在Visual Studio进行评论一文中,您可以突出显示你要评论的文本,然后用按Ctrl + K,然后按Ctrl + C.取消注释,你可以使用Ctrl键+ K,然后按Ctrl + U.
| 归档时间: |
|
| 查看次数: |
149241 次 |
| 最近记录: |