Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To: Stop Visual Studio XAML Editor from Adding mc:Ignorable

Whenever I run my Windows Phone application while the XAML page is open, Visual Studio adds the following to my XAML:

mc:Ignorable="d" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"   
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
d:DesignHeight="768" 
d:DesignWidth="480"

How can I stop it from doing so? I know it won't hurt me to keep it, but I don't want it in my code unless I need it.

Thanks

like image 525
TheBlueSky Avatar asked Feb 24 '12 05:02

TheBlueSky


People also ask

How do I disable XAML designer?

You can disable the XAML designer using the Options dialog box. To do so, open the dialog by selecting the Options item from the Tools menu. Once visible, expand the "Text Editor" section, then the "XAML" section at the left of the dialog box. Select "Miscellaneous" to show the correct options.

What is MC ignorable?

The mc:Ignorable attribute supports markup compatibility both for custom namespace mapping and for XAML versioning.

How do I enable XAML designer?

To open this page, choose the Tools menu and then choose Options. To access the XAML Designer property page, choose the XAML Designer node. Settings for the XAML Designer are applied when you open the document. So, if you make changes to the settings, you need to close and then reopen Visual Studio to see the changes.

How do I create an XAML file in Visual Studio?

To begin editing your first XAML file, use Visual Studio or Visual Studio for Mac to create a new Xamarin. Forms solution. (Select the tab below corresponding to your environment.) In the Configure your new project window, set the Project name to XamlSamples (or whatever your prefer), and click the Create button.


1 Answers

When creating any kind of predefined document Visual Studio uses built in default templates.

For instance for Visual Studio 2010 custom template for WPF UserControl looks:

<UserControl x:Class="$rootnamespace$.$safeitemname$"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>

    </Grid>
</UserControl>

File location at my PC: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\WPF\1033\WPFUserControl.zip\UserControl1.xaml

So as you can see Microsoft Team decided to include this namespace by default. I believe you can find such template for Windows Phone project as well, just look under the Visual Studio installation folder, and obviously you always can create and use own templates for any kind of document.

And what I found most neat - you do not need to restart Visual Studio in order to pickup template updates you made. I just removed mc:Ignorable from default demplate and tried to create a new UserControl - it was created using just updated template file, so Visual Studio 2010 pick up changes on the fly, this is nice, credits to Microsoft Team.


Looks like all available templates are grouped per Technology/Framework under this folder:

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\"

like image 98
sll Avatar answered Oct 02 '22 20:10

sll