Category Archives

Enabling / Disabling design data in Visual Studio 2015 Update 1

.NET, Blend, MVVM, Technical stuff, Universal Windows Platform UWP, Visual Studio, Work, XAML
No Comments

If like me you use design time data in Blend or the Visual Studio designer, you may have noticed a small change that is actually very convenient, but maybe not the most discoverable feature ever: You can now switch design time data on or off very easily!

To illustrate this, follow the steps:

  • Start Visual Studio 2015 Update 1.
  • (if you have not done so already) Install MVVM Light with: Tools / Extensions and Updates / Online –> Search for mvvm light and install the extension.
  • After restarting Visual Studio, select File / New Project and create a new MvvmLight (Win10Univ) application. This will create a new Windows 10 Universal project with all the MVVM Light scaffolding.
  • Open MainPage.xaml in the Visual Studio designer (or select Design in Blend from the context menu on MainPage.xaml).
  • Make sure that you set the configuration manager to x86 (not ARM or x64).
  • Build the application.

At this point, you will see one of two images below:


Figure 1: Design data is enabled


Figure 2: Design data is disabled

What’s the difference?

If you study both figures closely, you will see the difference at the bottom: Figure 1 shows actual data created in the code of the MVVM Light application (“Welcome to MVVM Light [design]” and the “Starting…” label for the Clock), while figure 2 shows the names of the databound properties (WelcomeTitle and Clock) instead. Switching from one figure to the other is done by using a new button on the design surface, which is a little hard to find. Here is an illustration:


This small button is tooltipped “Enable Project Code”.

What this button does is enable or disable a feature that MVVM Light applications are taking advantage of: The possibility to run some of your app code while the application is loaded in the visual designer. If the button is toggled on, the design time code will be enabled, which explains why the WelcomeTitle label shows the design time text, and the Clock shows the initialization text. This is useful, because it will allow you to design your app visually without having to actually run it, and so you will be faster.

On the other hand however, design time code can crash the visual designer. This type of errors can be fixed by updating the design time data, but they are time consuming, and sometimes it is just not worth it. In those cases, you may want to disable the design time code for the current view, which can be done by toggling the small button off.

In the case where the button is disabled, you can still edit the UI somehow, because the name of the property will be shown, and you can at least set the font, font size, foreground color  etc, which is better than nothing. For lists, this works too: If the design time code is enabled, the design time elements will be shown like in figure 3. On the other hand, if you disable the design time code, three “dummy” items will be created, which allows you to edit the item template visually. Here is an example taken from an app I am currently working on.


In addition, it also enables some level of design work with configurations that were not initially supported by the visual designer: ARM and x64. You can verify this by changing the configuration in the MVVM Light application above. Here the toggle button becomes disabled, and the view in figure 2 is displayed.

Having the possibility to disable design time code renders the visual designer more stable by allowing the user to eliminate possible design time error from the equation, and to still use the designer even if the design time code fails. It also allows some level of designer usage even with ARM or x64 configurations. This should accelerate things especially towards the end of the project, when maintaining the design time data can be time consuming.

Happy coding

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook

Watch the Connect() online conference on!

Technical stuff, Visual Studio, Website, Work
No Comments

On November 18th and 19th, you can watch the Connect() online conference streamed LIVE on and also directly here on this blog article.

Read the rest of this entry »

Upcoming speaking engagements and travels!

.NET, IdentityMine, MVVM, Technical stuff, Visual Studio, Windows 10, Work, WPF, Xamarin, XAML
1 Comment

Wow it’s autumn already! When did that happen? The Summer was very busy, with a lot of super interesting work at IdentityMine, the release of MVVM Light V5.2, and preparation for an upcoming article in MSDN Magazine (more about that later) and even some work on some personal apps I wanted to port to Windows 10 and improve.

In the coming few weeks, I have some travel coming up, with speaking engagements. Here is the list below, and I will update it if something new comes up. I really hope to have a chance to see you at one of these talks, and if you do come, please come say hi and let’s chat!

Read the rest of this entry »

What is the “ApplicationInsights” package in Windows 10 universal apps, and do you need it?

Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Work
No Comments

When you create a new Windows 10 universal application in Visual Studio, you might have noticed that a reference to Microsoft.ApplicationInsights is added to the references folder. In fact, there are three Nuget packages, and one ApplicationInsights.config file in your project. So what is this, and can you remove it?

Read the rest of this entry »

Announcing MVVM Light V5 for Windows and Xamarin

.NET, Blend, MVVM, Phone, Silverlight, Technical stuff, Visual Studio, Windows 8, Windows Phone, Work, WPF, Xamarin, XAML

Here at the Xamarin Evolve conference in Atlanta, I just announced the immediate availability of MVVM Light V5. This version runs on the following platforms:

  • Windows Presentation Foundation (3.5, 4, 4.5, 4.5.1)
  • Silverlight (4 and 5)
  • Windows Phone (7.1, 8, 8.1 Silverlight, 8.1 RT)
  • Windows Store (8, 8.1)
  • Xamarin Android
  • Xamarin iOS
  • Xamarin Forms

Read the rest of this entry »

XAML Intellisense just got better

.NET, Blend, Build, Design, MVVM, Phone, Silverlight, Technical stuff, Visual Studio, Windows 8, Windows Phone, Work, WPF, XAML

With the latest Visual Studio Update 2 release candidate came a pretty wonderful surprise from the XAML tools team: Improved Intellisense when you use MVVM Light.

Short story

After you install the latest update to Visual Studio, you will notice the following effect:

Read the rest of this entry »

A fix for the Visual Studio issue I reported before

.NET, Technical stuff, Visual Studio, Windows 8, Windows Phone, Work

One thing awesome at the Visual Studio team is how quick they are to react to issues, even when they are not responsible for the issue itself.

tl;dr: Xamarin was causing the issue, and a fix is available. See below how to install the fix.

Quick recap of the events:

  • On January 28th I reported an issue where Visual Studio would freak out when reopening a project. In Windows Phone, you would lose the ability to switch between device and emulators. In Windows Phone and in Windows Store (and maybe other frameworks too), you would get a lot of errors in XAML files (blue underlines). Intellisense would stop showing relevant information. If you had Resharper installed, the same thing was happening in C# files too, with a lot of errors reported. However it was still possible to build the application and to run it. In that blog post I proposed the fix of deleting the SUO file. This file stores some settings, such as the open documents, etc. For some reason, deleting the SUO file was forcing Visual Studio to reset its view and the issue was solved. But it would come back the next time you open the same project, unfortunately.
    Read the rest of this entry »

Quick tip: What to do when Visual Studio freaks out and everything is red

.NET, Technical stuff, Visual Studio, Work
Update: There is a fix available for this issue. See this post!

You might have seen this before: You open a project in Visual Studio, and almost every possible keyword is underlined red. Building works just fine, but the editor and Intellisense just freak out. In my case, working in a Windows Phone project, I couldn’t select the target (Device, Emulator 512, etc) in the combo box next to the “Run” button in the taskbar. It only showed “Start”.

Having just installed Xamarin, I first thought that it was the culprit. Or maybe Resharper. Anyway whatever the cause was (and I am still not 100% sure what actually triggered this behavior), recovering from it is actually quite easy:

Read the rest of this entry »