Kona – The ViewModelLocator Class

January 26, 2013

In previous posts I mentioned how, by using the Binding markup extension, the view automatically resolves its bounded properties from a view model object that is stored in its DataContext property. How the view model ends up being referenced in the view's DataContext property was left to be some kind of magic. In this post I will talk about the component that is responsible for making this happen – the ViewModelLocator. Before diving into the details, let's re-set the context. We have a simple view model with a single property, named FirstName: ...
no comments

Kona – The BindableBase Class

January 20, 2013

In the previous post I mentioned that the view's bounded controls can be updated automatically when the view model's properties to which they are bounded changes, given that the view model raises a specific event. In this post I want to elaborate on that, and walk you through the relevant implementation in Kona. The INotifyPropertyChanged Interface To provide change notification to the view's data bound controls, the view model should implement the INotifyPropertyChanged interface, which contains a single event called PropertyChanged, and raise that event whenever a property changes. The following example shows how the PropertyChanged...
no comments

Kona – Commands

January 18, 2013

The first thing I will cover in the series about Kona is the good old DelegateCommand class, that all of the Prism veterans learned to respect. But first, a quick overview for those of you who never worked with commands before. Why do we need commands for? One of the corner stones of MVVM is clear separation of the view from the view model. Those two components should be as loosely coupled as possible and interact only by using binding. To accomplish this separation, the view model exposes it's data with properties, and the view presents and...
no comments

Kona – Windows 8 LOB Apps Design Guidelines

January 14, 2013

Kona is an on-going project from Microsoft's patterns & practices team that is intended to provide guidelines and best practices for creating maintainable, testable and extendable Windows Store LOB apps. Kona is to Windows Store apps what Prism is to traditional WPF applications. Like Prism, Kona's release will contain the library itself (currently named Kona.Infrastructure), and a reference implementation. The first release of Kona is scheduled for the end of Q1 2013, and will provide guidance for subjects such as application lifecycle management, search, navigation, live tiles, local data management, proper layering, validation and more. The complete feature...
no comments

Setting a WPF Window to be Always on Top

January 5, 2013

Some applications require that their main window will always be on top of all the other windows. Doing so in WPF is quite simple. In this post I will show how. In order for the window to be opened on top of all the other windows, set its Topmost property to True. Doing just that is not enough, because when the window will lose its focus, it will be placed behind the focused window. To keep the window top-most even after it loses its focus, add an EventTrigger to the window's LostFocus event, and set the Topmost property...
tags: , , ,
no comments