Gor*_*ran 4 c# xaml xml-documentation
/// <summary>
///
/// </summary>
/// <remarks
///
/// </remarks>
Run Code Online (Sandbox Code Playgroud)
如何在上面的注释中添加xaml代码,避免代码解析器创建不存在的链接(CTRL + Click消息)?
在XAML视图中,将一些要用作注释的XAML
然后包围它
<!-- #region XAML Snippet -->
<StackPanel>
<Button Content="Click me, I do nothing!" />
</StackPanel>
<!-- #endregion -->
Run Code Online (Sandbox Code Playgroud)
注意:我把它放在MainWindow.xaml文件中,但它可以是任何XAML文件.
现在在C#中,将其用作注释:
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
/// <example>
/// <code source="MyProject.Namespace/MainWindow.xaml" region="XAML snippet" lang="XAML" title="A linked *.xaml file treated as XAML"/>
/// </example>
Run Code Online (Sandbox Code Playgroud)
SandCastle理解这种语法,并将生成适当的文档(如在MSDN中),但这不会出现在intellisense上.
你可以格式的正<summary>体>和<,而不是< >为了模仿XAML语法的迹象,但是这将是一个痛苦.
您有两种选择:
标准XML转义
/// <TextBlock Text="Hello World!"/>
CDATA部分
/// <![CDATA[<TextBlock Text="Hello World!"/>]]>
使用第一个选项,Visual Studio Intellisense将正确显示未转义的XML序列.