Alex Rivera | Logout

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

Asked 2012-02-24T05:38:55.813
9

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

Edit
Report

1 Answer

0

I couldn't find a configuration option or registry that stops Visual Studio XAML Editor adding the mc:Ignorable to a given XAML page.

Possible ways you could stop Visual Studio adding it include:

  • Closing your XAML Page manually before running your application
  • Closing your XAML Page automatically before running your application by extending Visual Studio (resources here) or using macros (macros are removed from Visual Studio 11 and onwards)
  • Setting the editor for editing XAML to just use the regular text editor inside of the XAML Editor. (resources here and here)
  • Removing the added XAML by having your application or post build step edit the XAML file. A partial code snippet is here. If taking the application approach you would need to edit the file and then reload the relevant control. Information on post build events is avaliable at How to: Specify Build Events (C#) and Gotcha! Visual Studio Pre/Post-Build Events for using a batch file.

Whether you need it or not depends on your use case for whether you need the design time width and height specified to Visual Studio's designer, which is your decision. For further information see mc:Ignorable Attribute for the Attribute its

answered 2012-04-02T11:09:43.053

Your Answer