Windows 8.1 – Localization

Today I want to share how I localized my Windows Store application, very easy! Localization can also be implemented using “Resources File (.resw)” files. I will try it soon but first I wanted to implement a solution using my already existing resx files.

To test the developing process for Windows Store and Windows Phone I am using this project structure:


All localization terms are already in a portable class library, so that they are share between the Windows Phone and Windows 8 applications.


The terms are contained in “resx” files:

  • AppResources.resx (default app language, English)
  •  (Spanish)
  • AppResources.fra.FR.resx (French)

These files contains a list of string properties that we can create be created easily using the editor:


Once the project is compiled a class “AppResources” with a property of type string with each entrance of the table is created. The value of the string is resolved using the resx corresponding to the current language of the UI Thread.

There are several ways to use this resources files in XAML, I wanted to use them with the support of IntelliSense, with my solution it is possible to define a common Localization Provider on my App.xaml that uses the resources files contained by the portable class library: Continue reading

Windows 8.1 – Application life-cycle

Windows 8.1 keeps in memory the status of an application when the user sends it to background. Although the application’s threads are frozen after about 10 seconds, the application status is kept in memory until the OS runs out of resources.

When the OS needs resources the application could be removed from memory and if this happens the status is lost.

Understanding the possible status of the application and the related events helps to create a better user experience.
e.g.: Serializing the application status to disk when it’s suspended to recover it later.

This diagram describes the life cycle of a Windows 8.1 application.

Windows 8.1 App Lifecycle

Windows 8.1 App Lifecycle


Windows 8.1 – Screen Mode Detection

During the development of my Windows Store application I faced out that is not that easy to detect the current screen mode to adjust consequently the layout.

These are the different screen modes available in Windows 8:

  • Portait orientation.
  • Landscape orientation, Full Screen.
  • Landscape orientation, Snapped. Sharing the screen with other applications, see the next image as an example.

Windows 8 - Screen Sharing

When the application is sharing the screen with other applications it is also important to distinguish between having a big portion of the screen or not:


In Windows 8 it was easier to detect the screen mode:

private void WindowSizeChanged(object sender, WindowSizeChangedEventArgs e) {
    // Get view state
    ApplicationViewState currentViewState = ApplicationView.Value;

    if (currentViewState == ApplicationViewState.FullScreenLandscape) {
       // Full screen Landscape layout
    else if (currentViewState == ApplicationViewState.FullScreenPortrait) {
       // Full screen Portrait layout
    else if (currentViewState == ApplicationViewState.Filled) {
       // Filled layout
    else if (currentViewState == ApplicationViewState.Snapped) {
       // Snapped layout

But in Windows 8.1 the ApplicationView is deprecated, developers can only know if the screen is in Landscape or Portrait. I implemented a helper class called ScreenManager to get the current screen mode, this class has also an Event to notify when the screen mode changed:

These are the Screen Modes that I defined: Continue reading

Windows Phone 8 – MVVM

I wanted to implement a simple Windows Store application to see how the publishing process works and compare the implementation with the implementation of a Windows Phone or Desktop WPF application. To do this I thought it would be a good idea to take the sample application I implemented for Windows Phone two years ago and migrate it to a Windows Store application. The application is a simple Chess Clock.

App Windows Phone Store Link

The idea is to refactor the actual code and implement exactly the same application for Windows Store.

There are some points that I wanted to improve from my previous version:

  • Get rid of the notification property changed code and trigger it automatically, Fody is great for this.
  • Remove the OnNavigateTo and OnNavigateFrom from my pages code behind, move this code to the view models. I implemented a couple of base class for this.
  • Separate my Models in two class, one should contain only the logic and the other one the status.

So far this is the class diagrams of my Game Clock: