Home > database >  Can mc:ignorable be used to create a XAML comment tag?
Can mc:ignorable be used to create a XAML comment tag?

Time:12-21

I would like to create a comment tag to use in my XAML so I can comment it. (Why there is no ready built-in way to do this baffles me.)

The code snippet below fails to compile with the error:

*Error      'mc:Ignorable' is a duplicate attribute name. Line 9, position 7.   TriCoordinate Math*         

Any help would be appreciated.


    <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">

CodePudding user response:

Found this in another question:

It works quite well. Much better than the dumb default mechanism which must be placed outside the tag entirely. (which is largely useless and often very confusing)

<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>

This implementaton of this method compiles correctly and is exactly what I was looking for.

<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>
  • Related