我想創建一個注釋標記以在我的 XAML 中使用,以便我可以對其進行注釋。(為什么沒有現成的內置方法來做到這一點讓我感到困惑。)
下面的代碼片段無法編譯并出現錯誤:
*Error 'mc:Ignorable' is a duplicate attribute name. Line 9, position 7. TriCoordinate Math*
任何幫助,將不勝感激。
<Page x:Class="TriCoordinate_Math.Views.GraphingPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Comment="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Style="{StaticResource PageStyle}"
mc:Ignorable="Comment"
mc:Ignorable="d">
uj5u.com熱心網友回復:
在另一個問題中找到了這個:
它運作良好。比必須完全放置在標簽之外的愚蠢默認機制要好得多。(這在很大程度上是無用的,而且常常令人困惑)
<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>
這個方法的這個實作可以正確編譯,正是我正在尋找的。
<Page x:Class="TriCoordinate_Math.Views.GraphingPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Comment="Tag used for commenting"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Style="{StaticResource PageStyle}"
mc:Ignorable="d Comment">
<Grid x:Name="ContentArea"
Margin="0"
Loaded="ContentArea_Loaded">
<Grid Background="{ThemeResource CustomAcrylicGraphingBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="40" Comment:Row0="application header"/>
<RowDefinition Height="1*" Comment:Row1="application body"/>
<RowDefinition Height="40" Comment:Row2="application footer"/>
</Grid.RowDefinitions>
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/388170.html
