notes of an interactive developer

Tag Archives: MVVM

With some help from Shawn Oster – I had the BindableApplicationBar published on NuGet. Now there is no need to search for sources or assemblies on CodePlex if you need to quickly create an MVVM-friendly ApplicationBar. Just right-click on your project and select “Manage NuGet Packages…”

Then search for appbar, install it and voila! You can now use the BindableApplicationBar.

Today marks the RC1 release of the BindableApplicationBar. I have spent some time today to do some StyleCop and documentation cleanup and it seems ready. You can grab a zip file with the binary directly from here.

Another part of what I have been working on today is a Windows Phone application template. I have spent too many times working on boilerplate code and cleaning up the default Windows Phone Application template and decided to create something that will get me up to speed faster every time I want to create a phone app. It is called Windows Phone Prism Application and is available as a Visual Studio project template here.

This is it – for now at least. The BindableApplicationBar meets all the original requirements and while I found some new ones that might be achievable – it might already be in many ways the richest solution to the problem.

Seems like the application bar finally works for predefined buttons. Next step – binding to ItemsSource-like view model collections for buttons and menu items and getting “ElementName bindings” to work…

For now – this will have to be it. I am sharing my library and test projects here.

This morning I was trying to bind the Orientation property of a PanoramaItem to a panorama item view model bound to the Panorama through its ItemsSource property and kept getting this weird exception when Silverlight was parsing the xaml stating that it “Cannot set read-only property”. I tried working around that and have some sort of attached property that would be bound to Orientation property of the view model and update the PanoramaItem’s Orientation property, but that produced the same result…

Well, it just so turns out – it is one of those things that are supported in WPF, but not in Silverlight…

As a workaround – I created some attached dependency properties that are not bound to the view model themselves, but specify just the binding path and when set – create a binding to the PanoramaItem properties – as below…

The funny thing about MVVM is that you might get so hooked on it that when you find something that just does not work with MVVM – you start trying to figure out how to bend it to the right path. One of such things is the ApplicationBar on Windows Phone.

The below sample shows how you can use attached dependency properties to style a Grid’s RowDefinitions. This specific case shows how a single property can be set to specify the number of rows in a Grid.