Windows 8

Thoughts about WinRT, Windows 8 and more.

Using the predefined buttons styles for the ApplicationBar in Windows 8

When you create a new Windows 8 application, the Common folder contains a file named StandardStyles.xaml. Amongst other styling resources, this file contains a trove of application bar buttons styles, including Microsoft Design-like icons. In order to use these styles, however, you need to uncomment the corresponding one. Microsoft commented these styles out, because otherwise they would be instantiated by the XAML parser when the app starts, which would cause some delays and use unnecessary memory. ...

Session material from TechDays BE and NL

UPDATE: Added the videos Note: Like all material on this blog, this blog post and all the referenced material are licensed under the Creative Commons Attribution 3.0 Unported license. You are free to reuse material from this post and from the referenced material, but you must attribute this material to me, and link to this blog post, or to my website. Thanks! I had the chance to be invited again to speak at TechDays in Belgium (Antwerp) and in the Netherlands (The Hague), and delivered 3 sessions ...

MVVM Light V4.1.27.0 in Nuget

I just pushed a new version of MVVM Light to Nuget. The new version is 4.1.27.0. The difference towards the previous version (4.1.26.1) and this one is that I am not depending on the CommonServiceLocator Nuget package instead of providing my own. However, the CommonServiceLocator does not exist for all MVVM Light-supported frameworks. We have the following situation: WPF3.5 SP1, WPF4, WPF4.5: Depends on the CommonServiceLocator Nuget package. Silverlight 4, Silverlight 5: Depends on the CommonServiceLocator ...

Using async/await with WebClient in Windows Phone 8 (or: TaskCompletionSource saves the day)

When you share code between Windows Phone 8 and Windows 8, you can use async/await to code against asynchronous APIs, which is a nice step in the right direction. However there are Windows Phone APIs that do not support async/await yet. Probably the most annoying to date is the WebClient (which in Windows 8 has been replaced by a better API called HttpClient). Now, HttpClient’s methods support async/await. But WebClient’s methods do not support it, and so we have to resort to the old Completed event. ...

2012 in review

It seems it was only yesterday that I was writing about starting my 4th year at IdentityMine, and here we are now, more than a year later. The year 2012 has been particularly interesting for all of us in the tech space, and particularly for us who are observing the Microsoft brand. Now, those of you who know me also know that I am an undying optimist (something that is sometimes mistaken for fanboism), so I will make a big effort in adding a dose of realism into this billet. Nonetheless I think we ...

MVVM Light V4.1.26 change log

I just published the change log for MVVM Light V4.1.26, which is available on Nuget only at this time. The full version is available here, while the “libraries only” version is available here. I am working on an installer which will also add a few more changes to the templates and one bug fix in the code snippets. Stay tuned for that installer as soon as I figure a few things out. Important note: V4.1.26 is only available on Nuget (here and here) at the current time. An installer will be published ...

Oredev 2012: Summary and source code

This week, I had the pleasure to be invited to talk at Oredev, a really cool conference taking place in Malmo, Sweden. The whole event is awesome, including a very special dinner on Monday including sauna and swimming in a 6 degrees cold Baltic sea, and a reception with dinner at the town hall, including the mayor himself. Considering Malmo is a town of 300'000 inhabitants, it is a pretty nice occasion and the historical building itself is really worth seeing. For those interested, I placed my pictures ...

MVVM Light V4.1 with support for Windows Phone 8

Today is a very exciting day: After the official release of Windows 8 (and Microsoft Surface!) on Friday, and the official release of Windows Phone 8 on Monday, the Build conference is starting! This is the conference in which we will learn all about the developer experience for Windows 8 and Windows Phone 8. As a partner of Microsoft, I had the privilege of trying out some of the new things early, and this gave me the opportunity to port MVVM Light to Windows Phone 8 (it was already running for ...

“Using the MVVM pattern in Windows 8” in MSDN Magazine

These days I am swimming in Windows 8 code, and I must say it is a good feeling. This gives me the occasion to push MVVM Light and a few other components of mine to their limits, and to fix or improve a few things on the fly. All this goodness will be available in V4.1 which is scheduled shortly after Windows 8 launch. In spite of the busy schedule, I couldn’t resist writing an article for MSDN magazine about, you guessed it, the MVVM pattern and MVVM Light in Windows 8. It is an article that goes ...

Adventures in Windows 8: Working around the navigation animation issues in LayoutAwarePage

LayoutAwarePage is a pretty cool add-on to Windows 8 apps, which facilitates greatly the implementation of orientation-aware (portrait, landscape) as well as state-aware (snapped, filled, fullscreen) apps. It has however a few issues that are obvious when you use transformed elements on your page. Adding a LayoutAwarePage to your application If you start with a blank app, the MainPage is a vanilla Page, with no such feature. In order to have a LayoutAwarePage into your app, you need to add this class ...

Adventures in Windows 8: Solving activation errors

Note: I tagged this article with “MVVM” because I got a few support requests for MVVM Light regarding this exact issue. In fact it is a Windows 8 issue and has nothing to do with MVVM Light per se… Sometimes when you work on a Windows 8 app, you will get a very annoying issue when starting the app. In that case, the app doesn’t not even start past the Splash screen. Putting a breakpoint in App.xaml.cs doesn’t help because the app doesn’t even reach that point! So what exactly is happening? Well when ...

Adventures in Windows 8: Understanding and debugging design time data in Expression Blend

One of my favorite features in Expression Blend is the ability to attach a Visual Studio debugger to Blend. First let’s start by answering the question: why exactly do you want to do that? Note: If you are familiar with the creation and usage of design time data, feel free to scroll down to the paragraph titled “When design time data fails”. Creating design time data for your app When a designer works on an app, he needs to see something to design. For “static” UI such as buttons, backgrounds, etc, ...

Adventures in Windows 8: Placing items in a GridView with a ColumnSpan or RowSpan

Currently working on a Windows 8 app for an important client, I will be writing about small issues, tips and tricks, ideas and whatever occurs to me during the development and the integration of this app. When working with a GridView, it is quite common to use a VariableSizedWrapGrid as the ItemsPanel. This creates a nice flowing layout which will auto-adapt for various resolutions. This is ideal when you want to build views like the Windows 8 start menu. However immediately we notice that the Start ...

#mvvmlight V4 update for Win8 RTM

With Windows 8 RTM out of the doors (at least for some of us), it was also time to create an update to MVVM Light. I selected the V4 RTM to do this (V4.0.23).This RTM version was released a few weeks ago with no much bells and whistles because I was just too busy to write much about it. Now after some vacation, I will resume blogging on all my favorite topics including of course MVVM Light. Upgrade Upgrading the installations should not require an ununistall, so try to simply run the MSI downloaded ...

#mvvmlight V4 for Windows 8 RP is available

I took a moment out of a very busy weekend to publish an update to MVVM Light for Windows 8 Release Preview. You can download the DLLs from the Codeplex site. Or, if you use Nuget, you can update the MVVM Light package, which will install the newest DLLs. For more information about Nuget, visit Nuget.org as well as the MVVM Light Nuget page. Note: I also took the occasion to fix an issue where the DLLs for the .NET 4 framework were not signed. The DLLs contained in this package are properly signed. ...

Fixing the certifications issues for the Windows 8 App Store and #mvvmlight

If you used the latest MVVM Light version for Windows 8, you may have noticed that a couple of issues cause your app to fail the Windows App Certification Kit. It is really quite simple: By mistake, I published the debug version of the assemblies instead of the release version. This causes the certification to fail. I already published an update on Nuget, so if you have created your application and added the DLLs using Nuget, you can update with the steps described her (scroll down to the “Updating ...

Celebration! 120’000 downloads for #mvvmlight, 2 copies of Expression Studio to win

That is a symbolic milestone: Last week, MVVM Light reached the bar of 120’000 downloads on http://mvvmlight.codeplex.com, the site that has been hosting source and installers since the beginning of the project (100'000 downloads) and on Nuget, the popular package manager for .NET (20'000 downloads). More information about Nuget and MVVM Light. Scroll down to have a chance to win a copy of Expression Studio V4! MVVM Light started its “career” on Codeplex in October 2009. Back then it was intended ...

Metro design inspiration

[This is the English version of an article I wrote for the Netzwoche publication in Switzerland. This is part 2 of a 3-parts article about Metro. The original article in German can be found online on the Netzwoche website.] With Windows 8, Microsoft is going to potentially install their new design language called Metro on a massive amount of computers of all shapes, from thin low-powered slates to full scale PCs. However Metro was not born overnight and in fact a lot of research was put into it. ...

ICommand issue in Windows 8: Correction!

Well I'll be… I stand corrected! I recently published a blog post stating that you need to declare a command as ICommand (instead of RelayCommand) if you want it to work in Windows 8. I even went as far as to modify the MVVM Light code snippets that are used to create commands. In fact, scratch that post… I was wrong! I got a few people writing to me and letting me know that RelayCommand works just fine for them. And now, after I tested again, I cannot reproduce the issue! So I need to be clear, ...

#mvvmlight V4RC available on #nuget

I just published the MVVM Light V4 RC packages to Nuget. Note that this is still technically a preview, so the main package is still V3. The V4 packages are available here: Package with libraries and content: When you install this package into a “virgin” application (i.e. an application without ViewModelLocator, preferably a brand new application), it installs a new ViewModel folder with a MainViewModel, ViewModelLocator and adds an entry into the App.xaml file to intialize a the ViewModelLocator ...

Declaring an ICommand in Windows 8 Consumer Preview

[Update 24/4/2012]Well I'll be… after I posted this, a few people wrote to me and told me they are unable to repro the issue. I then tested again and indeed, it works. No idea why I couldn't get it to work in the first place.More details here. Sorry about the confusion people

Slides and source code for my past talks this year

I had the chance to be invited to talk at various conferences this year already, and I promised to post the slides and source code, so here it is! MVVM Applied: From Silverlight to Windows Phone to Windows 8 Belgium, Netherlands, Bulgaria The Model-View-View Model pattern is a common denominator between applications using XAML to create the user interface. First applied in WPF, it was then easily ported to Silverlight and Windows Phone development. With WinRT and the Metro-style applications, XAML ...

Fixing the #mvvmlight code snippets in Visual Studio 11

If you installed the latest MVVM Light version for Windows 8, you may encounter an issue where code snippets are not displayed correctly in the Intellisense popup. I am working on a fix, but for now here is how you can solve the issue manually. The code snippets MVVM Light, when installed correctly, will install a set of code snippets that are very useful to allow you to type less code. As I use to say, code is where bugs are, so you want to type as little of that as possible ;) With code snippets, ...

How to work around a possible XNA Game Studio or Windows Phone SDK install failure on Windows 8

I am not sure if you guys know Aaron Stebner. Aaron works at Microsoft, and has pulled thorns from my side many many times already. His blog is at http://blogs.msdn.com/b/ast... and it is a gold mine of tips and tricks to debug and solve many cryptic issues happening during installation and removal of programs. For example, Aaron taught me how to remove programs that do not appear in the Programs and Features list, amongst many other things. The last nugget I used from Aaron’s blog saved my butt ...

MVVM Light V4b1 for Windows 8 Consumer Preview (with installer)

I just pushed the following to Codeplex: A new MVVM Light project template for Windows 8 Consumer Preview. This template appears in the File, New Project dialog and allows you to create a Metro style app already wired with MVVM Light. An updated Windows 8 installer for MVVM Light. Preconditions: This installs MVVM Light for Windows 8 only. You can install it side-by-side with the standard MVVM Light for Silverlight, WPF and Windows Phone. Where do I get it? You can download the MSI from: http://mvvmlight.codeplex.c... ...

The gestures of Windows 8 (Consumer preview): part 2, More about Search

This is part 2 of a multipart blog post about the gestures and shortcuts in Windows 8 consumer preview. Part 1 can be found here! More about the Search charm In the first installment of this series, we talked about the charms and mentioned a few gestures to display the Search charm. Search is a very central and powerful feature in Windows 8, and allows you to search in Apps, Settings, Files and within Metro applications that support the Search contract. There are a few cool features around the Search, ...

The gestures of Windows 8 (Consumer preview): part 1

This blog post started as a simple one, but grew to be quite large and time consuming. I am splitting it, because I really want to publish the first findings already. Stay tuned for more! I am sure that you heard that Windows 8 was released last week in an early although quite stable stage called "consumer preview". Windows 8 is an interesting mix of touch-based and mouse/keyboard based system. Some aspects are a bit annoying (see my post about the "split personalities" in Win8 to see what I mean!) ...

Impressions, slides and code from TechDays Belgium and Netherlands

Update: Posted the video of “MVVM Applied” below. This week I was “on tour” in Belgium and Netherlands and presented 3 times: “MVVM Applied, From Silverlight to Windows Phone to Windows 8” (in Belgium and Netherlands) The goal of this session was to make people feel confident that the skills they acquired working in various XAML frameworks (Silverlight, Windows Phone, WPF, Surface, etc) are going to help them tremendously when developing Windows 8 applications. It was a session packed with code, ...

Solving the ObservableCollection bug on Windows 8

If you tried to build applications for Windows 8 with XAML/C#, you may have noticed an annoying issue: If you have a list controls (for example a GridView) and you bind the ItemsSource property to a property of type ObservableCollection<Som... on your ViewModel, the GridView is not updated when the collection’s content changes. The CollectionChanged event is raised properly, but it is not honored by the binding system. Thankfully, this is a temporary bug, and it should be solved in the ...

Screenshots of my #mvvm demo at #techdaysbe

Today I gave a talk in TechDays in Belgium about MVVM in Silverlight 5, Windows Phone 7 and Windows 8. This was the first time I gave that particular talk, and in addition keep in mind this is a developer preview, meaning that it is not finished, and not always stable. I had a few surprises with this build. For example from time to time, the new “Metro style applications” just cannot be launched anymore. Nothing that a simple reboot cannot fix… but I’ll come back to that in a moment. A couple of ...

Quick travel tip: charging USB devices from the Samsung Slate 7

For those of you who have the Samsung Slate 7 that Microsoft gave at Build (or that you purchase yourself!), and who are travelling: I hate to take chargers for all my gadgets, especially since my Windows Phone, my Bluetooth stereo headset and my Kindle (amongst others) all use micro-USB to charge. So I just take a couple of micro USB cables and I can charge my devices from the PC. However some laptops are cutting off power from the USB ports when they go to sleep. I thought it was the case with ...

MVVM Light Toolkit for Windows 8 (preview) #mvvmlight #win8

I was very optimistic when I first saw Metro style apps coded in C# on Windows 8, because for the most part they are not much different than the well known XAML/C# pair on Silverlight or WPF. This led me to brag a bit about probably having a port of MVVM Light ready “in a few days”. Of course I didn’t take in account that I would have a great time the week after //build in Seattle, with fantastic weather and tons of friends to have dinner and conversations with. Needless to say, the few days turned ...

Breaking change: Raising PropertyChanged with string.Empty in WinRT / Windows 8

In the developer preview of Windows 8, I just noticed a breaking change in the way that data bindings react to the PropertyChanged event. First a bit of background: Often, objects that are databound to the UI are simple data objects (also called ViewModels) that implement the INotifyPropertyChanged interface. This interface is very simple and defines just one event, the PropertyChanged event, that needs to be raised by the ViewModel when one of its property changes. It is what makes the ViewModel ...

Quick tip: Killing a Metro-style app in Windows 8

Metro-style apps are very similar to Windows Phone apps. They have a similar application model (for example they can be suspended, and when suspended they can be killed by the operating system if memory is needed), so they need to maintain state. Also, and that is the topic of this post, they cannot be ended by the user in a “normal” way, i.e. there is no File / Exit menu and no “X” button in the corner. Once started, the application remains in memory until the following happens: The app is in suspended ...

Quick tip: Select the correct INotifyPropertyChanged in Windows 8 / WinRT

Microsoft loves MVVM and INotifyPropertyChanged so much that they included this very useful interface twice in the new WinRT framework. Unfortunately, only one of these is working correctly (and the other one is likely a bug, remnant from the past ) When implementing INotifyPropertyChanged, make sure that you select the correct one! The one you want to use is into Windows.UI.Xaml.Data. The old one, the one you DON’T WANT is into System.ComponentModel (the same namespace it was in WPF and Silverlight). ...

Detecting design mode in Windows 8/WinRT

One of the very useful features of the MVVM Light toolkit is to help with the creation of design time data, in order to give something to see on the design surface (Expression Blend, Visual Studio designer). This is especially useful when designing list controls such as ListBox, ComboBox, etc. Without design time data, these controls will remain empty, and the designer will not see what he is working on. This can cost a lot of time and cause frustration. Detecting design mode was always incompatible ...

Dealing with types in WinRT

Another quick tip: Most of the interaction with the System.Type class in Windows 8 is now done through the TypeInfo class. An instance of TypeInfo for a give type is retrieved using an extension method called GetTypeInfo(). Note that since this is an extension method, it will not be visible in Intellisense unless you add a reference to System.Reflection in the “using” section: // Needed for the extension method using System.Reflection; (...) var info = myType.GetTypeInfo(); // Was: string name = ...

Running unit tests in Visual Studio 2011 and Windows 8 (WinRT)

This is a quick tip, because it confused me at first. But thanks to the always excellent Tim Heuer and Peter Provost (from the Visual Studio team), here is the answer: Usual disclaimer: This is for XAML/C#. I am not sure how this works for the other programming stacks. Creating unit tests for your WinRT application/library Start Visual Studio 2011. Create a new project. From the Add New Project dialog, select Unit Test Library (In the Visual C#/Windows Metro Style category). Give a name to the project ...

My Windows 8 slate has split personalities–and what Microsoft could do to improve that

I had dinner the other night with my good friend Josh Smith, and of course we started talking about Windows 8. Something he said was pretty much spot on: He said that Windows 8 feels as if it has split personalities. There are the WinRT “Metro-style” apps and there is the “classic” Desktop, which looks and feels like Windows 7++ (optimized for touch, and actually a real delight to use with my fat greasy fingers). Side note: I really dislike more and more the name “Metro-style” for the WinRT apps. ...

Quick tip: Adding objects in resources.

If you are using MVVM-Light style ViewModel creation (often referred to as “view-first”), you might have noticed that you cannot build if you have an object in the view’s resources. It means that the code below does not compile. <UserControl.Resources> <vm:MyViewModel x:Key="MyViewModel" xmlns:vm="using:Application... /> </UserControl.Resources> <UserControl.DataContext... <Binding Source="{StaticResource MyViewModel}" /> </UserControl.DataContex... I was ...

What to do if the Bluetooth keyboard stops working? (#Win8 #bldwin Samsung slate)

At times it is quite tough to be on the bleeding edge. I have been using the Samsung slate that Microsoft gave us at the Build conference last week for about 5 days now, and in fact I even left my laptop (a Touchsmart TX2 that I like a lot but that is getting old a bit) at the hotel. One issue I had today is that the Bluetooth keyboard stopped working. I tried removing and reading it from the Devices dialog, but it didn’t work. In order to re-add it in a clean way, this is what I did, and it worked: ...

So did you notice? (Invisible references in WinRT apps)

Just a quick note: When you create a new WinRT application for XAML/C# in Visual Studio 11, you will notice that the References folder is empty. Well don’t fret, it is absolutely normal. Microsoft decided that all the WinRT assemblies are always referenced by default, and thus is doesn’t quite make sense to show them in the Solution Explorer. You will see in this References folder only your own referenced assemblies, third party libraries, etc. Microsoft is looking for feedback. Is it confusing you? ...

My thoughts about Build, Windows 8, WinRT, XAML and Silverlight

Last week, Microsoft held their long awaited Build Windows (or simply "Build") conference in Anaheim CA. About 5000 people packed the convention center to discover the latest version of the Windows operation system: Windows 8. This is a very major iteration (much more than the Windows Vista –> Windows 7 transition) (and also, it is an early preview so it is quite unfinished ;) As such, we will definitely need a bit more time to play with it before we can express a truly informed opinion. Of course ...