HowTo: have Visual Studio open XAML documents in code view

Just a small post to start the new year… and let it be a good one!

When opening a XAML document in Visual Studio, it opens in split view by default. This might become annoying when you have a large XAML document, because all the content needs to be rendered before you can get some work done.

Here’s how you can have Visual Studio open XAML documents in code view:

  • Go to Tools, Options
  • Under Text Editor open the XAML section and select Miscellaneous
  • Under Default View check the Always open documents in full XAML view box (see image below)
  • Click OK to apply and you’re all done!

Hope this helps.


Making Valid choices

Valid logo

As of December first I’ll be joining the ranks of Valid ( – Dutch website). I’m very excited to start over there and I am convinced we will be able to do great stuff together :)

I would also like to take this opportunity to thank BDO ( – Dutch website) for the past period and wish them all the best with the plans for the future of ‘our’ system.

Update 14 Jan 2011
Valid now has (the beginning of) an English website available: see here.

By |October 29th, 2010|Personal, Work|0 Comments

Little-heard-of ASP.NET feature: app_offline.htm

Although the feature has been around since ASP.NET 2.0, I still meet people that don’t know and/or use app_offline.htm. Do you know (and use) the feature…?

When working on an ASP.NET web application, you should notify your visitors in a decent way that your application is down. There’s a nice default feature available for these purposes since ASP.NET 2.0. Somehow, however, this feature is not very well known and rarely used. The “App_Offline.htm” feature in ASP.NET 2.0 provides an easy way to bring down an ASP.NET application while you make changes to it. This feature kicks in as soon as you place a file called app_offline.htm in the root of the application. When ASP.NET detects the file, it will shut-down the app-domain for the application and won’t restart it for requests. The app_offline.htm file will be sent as the response to all new dynamic requests for the application. When you’re done updating the site, just delete or rename the file and your site it will come back online.

Taken from (or actually inspired on) this blog post of Scott Guthrie:

Keep an eye on a feature of IE6(+) called “Show Friendly Http Errors”. This can be configured in the Tools->Internet Options->Advanced tab within IE, and is on by default with IE6. With this setting turned on, when a server returns a non HTTP-200 status code with less than 512 bytes of content, IE will not show the returned HTML and instead substitutes its own generic status code message.

If you use the app_offline.htm feature, make sure you have at least 512 bytes of content within it to make sure that your HTML shows up to your users instead of IE’s friendly status message. If you don’t want to have a lot of text show-up on the page, one trick you can use is to just add an html client-side comment with some bogus content to push it over 512 bytes. For example:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>

<html xmlns=”” >


    <title>Site Under Construction</title>



    <h1>Under Construction</h1>


    <h2>We’re currently working on our site…</h2>



    Adding additional hidden content so that IE Friendly Errors don’t prevent

    this message from displaying (note: it will show a “friendly” 404

    error if the content isn’t of a certain size).


    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2> 

    <h2>Gone to Florida for the sun…</h2>     




Hope this helps

"AjaxControlToolkit is undefined"

Because we were still using an old Visual Studio 2005 solution which included a Web Site project, it was time to upgrade. We upgraded our Visual Studio 2005 solution to Visual Studio 2010 (and .NET 4.0), converted the Web Site Project to a Web Application Project and then, of course, the AjaxControlToolkit had to follow. I downloaded the latest build from their Codeplex site and updated the references in the different projects. I ran the website, and that’s where things got ugly…

Most pages worked nicely, but there were a few that gave an “AjaxControlToolkit is undefined” error. I removed all references to the AjaxControlToolkit, removed all the old versions of it from my machine, referenced the most recent version again, all to no avail. After Googling* Binging the error I found a LOT of possible solutions. These included:

  • Use the ToolkitScriptManager from the AjaxControlToolkit in stead of the built-in ScriptManager
  • When using the ToolkitScriptManager, set CombineScripts to false
  • When using the ToolkitScriptManager, set EnablePartialRendering to true
  • Clear the browser cache
  • Clear the ASP.NET Temporary Files directory
  • Use a (dummy) control to make sure the JavaScript files have been loaded correctly

Unfortunately, none of these possible solutions helped us with our specific problem. Our problem occurred when we, for instance, set the PositioningMode for a control from custom JavaScript using the AjaxControlToolkit.PositioningMode enumeration. The error was always from custom JavaScript. After looking around a bit more I found one site that mentioned something about changing the AjaxControlToolkit ‘namespace’ in JavaScript.  After playing around a bit I found out that changing the use of AjaxControlToolkit.XXX to System.Extended.UI.XXX provided the solution.

Hope this helps.

* Of course this is a weak attempt at a joke, but fact is that Google (the first 7 or so pages) only pointed me in the direction of the solutions that weren’t solutions for my situation. When I tried Bing for a change, I found something that put me on the right track pretty fast. Kudos to Bing!

Visual Studio: Zero-impact Projects & Cutting/copying empty lines

Yesterday I remembered two Visual Studio options Sara Ford told about in a presentation of her I attended a while back. Changing them made me happy… :)

Zero-impact projects
When I have to test something real quick, I tend to create a new project in Visual Studio and scribble some code to test whatever I want to test at that point. This causes my project directory to be filled with projects named ‘WindowsFormsApplication14’ or something like that. To make this stop, go to Tools – Options – Projects and Solutions – General. Uncheck the option ‘Save new projects when created’. This way those newly made (and shortly used) projects aren’t saved untill you explicitly tell Visual Studio to do so. No more ‘WindowsFormsApplication63’ for you! Unless you want to name it that way intentionally, of course…

Cutting/copying empty lines
We probably all experienced this at one time or another: you select some code, copy it, go to an empty line where you want to past the code…….and you press CTRL + C by accident. With the default settings, you just copied an empty line and have lost the stuff you copied earlier. But with this next option, empty lines won’t get copied or cut anymore! Go to Tools – Options – Text Editor – All languages (or just the language you want to change this setting for) and deselect the option ‘Apply Cut or Copy commands to blank lines when there is no selection’.

Visual Studio 2010: Close all documents

Sometimes it’s the little things that make you love a new product just a bit more.

I tend to close stuff I don’t use anymore fairly quickly. Sometimes I even close an Explorer window or an application right after I used it, only to find I need it again in a few moments… We all have our quirks, right ;)

While developing I regularly close all the documents I have open in Visual Studio, especially when I am done with a specific task. And most of the time, I like to collapse all the projects and their subfolders too to keep a tidy work environment. I also have the option ‘Track Active Item in Solution Explorer’ checked under ‘Tools’ – ‘Options’ – ‘Projects and solutions’ – ‘General’. Of course I have, I’d almost add…

In older versions of Visual Studio (while having the ‘Track Active Item in Solution Explorer’ option turned on) choosing the ‘Close all documents’ item in the ‘Windows’ menu after having collapsed all the projects lead to one project opening up again. That was the project with the document that was active just before closing all the documents. The ‘Track Active Item in Solution Explorer’ option seemed to squeeze in a ‘Look at that guy!’ just before all the documents actually closed, making Visual Studio open up the project and highlighting the file again. Although I knew this happened, I somehow kept to my usual routine of collapsing all the projects and their subfolders before closing all documents, with the same result each time: me closing that one project (or those seven subfolders) twice.

But…… no more in Visual Studio 2010! This newly built IDE seems to understand my way of work: no longer does Visual Studio (or the ‘Track Active Item in Solution Explorer option) open up the project of an active item when I choose ‘Close All Documents’. I’m not even sure if this was a specific choice or just a coincidental side-effect of the new IDE, but it makes me love Visual Studio 2010 just a bit more… :)

Visual Studio 2010 and the web.config

While working with Visual Studio 2010, a new feature caught my eye that isn’t communicated (strongly) in the “What’s new” lists you can find online. As part of the Visual Studio 2010 supports  multiple web.config files! Now we can create a separate web.config file for each configuration we have for our application. If you add a configuration through the configuration manager, you have the possibility to add a web.config file  for the new configuration too.

A web application gets two configurations by default: a Debug and a Release configuration. When opening the plus sign in front of the web.config file, two extra files appear: web.debug.config and web.release.config.  Depending on the active configuration, Visual Stusio selects the correct version.

The web.config file contains the default configuration. Configuration specific config files may add or remove settings or change current ones. This is done using simple transformation tags.

For more information on transformations have a look at:

Changing lanes

As you probably know I’ve worked for my own company for quite a while (see my post ‘A new challenge‘ of October first 2008). Because business was good, I had way too little time to keep this blog up to date. Sorry for that…

Since the beginning of this month, that all has changed: I joined BDO (Dutch site) and can now work ‘normal’ hours in stead of ‘I-own-my-own-company-and-have-to-make-every-minute-of-every-day-count’ hours. I’ll probably still be pretty busy, but there’s a difference between busy and busy… ;)
I’ll be keeping you posted about stuff I run into, think about or find interesting. As long as they have anything to do with software development of course… And if you have any suggestions, questions or requests: let me know.

“The project location is not trusted”

After installing Windows 7 and Visual Studio 2010 on my laptop, I ran into the well-known message “The project location is not trusted”. I thought all I had to do was follow the instructions in this MSDN article to get my development share to be trusted again, but this doesn’t seem to work.

I already tried adding the new child group under the Internet_Zone in stead of the LocalIntranet_Zone, and using the complete server name and the server IP address in stead of the name of the server. All of these steps did not solve the message popping up…

I’m open to any suggestions, ‘cause this problem is beginning to drive me nuts.

Running Windows Vista on a MacBook Pro

When installing Windows Vista on a MacBook Pro, the default driver for the Wireless Network Adapter doesn’t function properly. To get the Wireless Network Adapter to work, first install the Boot Camp Services by inserting your OS X DVD and running the setup. Next you need to install the Boot Camp 2.1 update. You can download that one by running Apple Software Update, which is installed as part of the Boot Camp Services. And that’s where things go wrong… The Boot Camp update installation downloads properly, but doesn’t complete.

The reason the update doesn’t install properly? The Boot Camp 2.1 update is American only and therefore expects to find a key in the registry with the decimal value 1033 (American English). Since the Windows version we installed was Dutch, the update couldn’t complete.

How to fix this issue
To fix this problem, follow the steps below:

  • Open the registry editor
  • Search for the ProductName key with the value ‘Boot Camp Services’ (for the Dutch version, this was ‘Boot Camp-Services’), located under HKEY_CLASSES_ROOTInstaller and then some…
  • Double click the Language key in that same location to open it
  • Change the value to 409 (Hex) or 1033 (Decimal)
  • Reboot the machine and install the Boot Camp update
  • That’s it!

Hope this helps.

By |July 10th, 2009|HowTo|0 Comments