Developing for Modern Windows

Tips, tricks, and guides for developing on modern Windows platforms

Windows 8.1

Async OnNavigatedTo in WinRT Universal Apps

By default, a page’s OnNavigatedTo() method page is not asynchronous, but you can add the async keyword: protected async override void OnNavigatedTo(NavigationEventArgs e) { navigationHelper.OnNavigatedTo(e); await DoSomethingAsync(); } Now you can start a network data download or read files from disk… Continue Reading →

Serializing Sub-Classes in XML

I recently came upon a problem when serializing a class to XML using my standard serializing technique. It wouldn’t serialize a list of Vehicle objects: List<Vehicle> vehiclesList { get; set; } This gave an error message like this:   Unfortunately… Continue Reading →

Making Buttons with Style

The built-in Windows app XAML controls are great, but sometimes you need something more stylish. XAML styles to the rescue! Those two pink buttons have all the same properties, but one is the default style and the other is a custom style. They look completely… Continue Reading →

Tip: Place Code before InitializeComponent

Did you know you can place code before the InitializeComponent line in a Windows app? Usually it’s taken for granted that an app page constructor does this: public MainPage() { this.InitializeComponent(); // your code goes here } this.InitializeComponent(); is what… Continue Reading →