The Silverlight TabControl doesn't inherit from the Selector class (It does in WPF, please bring these technologies closer!) so you can't use the example from my previous entry.

I've put together a quick example which returns the SelectedItem via commanding etc.

SilverlightTabControlAndCommanding.zip (1.23 mb)

Does anyone know of a better way to do this? I couldn't use a binding into CommandParameter as it is updated after the command fires. I've had to set it in the code behind of the behaviour which is a bit of a hack or am I just being pedantic?

Flex


I remember when first getting to grips with the MVVM pattern, Prism & Silverlight one of the issues was getting commanding working with controls that allow selection. I wish there had been a simple example explaining how to do this, however hunting around and reading everything I could wasn't a bad thing either.

Prism only supports the click command out of the box which is fairly limited. There are some good examples of how to set up the behaviour for the selection command but nothing on how this fits in with Prism.

 

I've put together a quick example of how this works. I've used the behavior from Brian Genisio's excellent blog (Method 3 of  http://geekswithblogs.net/HouseOfBilz/archive/2009/05/29/adventures-in-mvvm-ndash-commanding-with-list-boxes.aspx).

 

Additionally, Damian Schenkelman has a great code snippet which is a massive time saver which will create behaviours for you. Well worth the install. http://blogs.southworks.net/dschenkelman/2009/08/13/c-code-snippet-to-create-commands-with-attached-behaviors-using-prism/

 

Get the sourcecode here: SilverlightComboAndCommanding.zip (1.35 mb)

Flex


Because of the issues with browser caching we can't always be certain that our Silverlight application will be the latest version running.

If you need to deploy a new version which breaks backward compatibility then you're stuck unless you implement your own wrapper.

The following is a quick example of how to deploy your own stub that will ensure the latest version of your Silverlight client is always running. It doesn't matter if the stub is an older version as it shouldn't need to change once you have the code bedded in.

I personally think this should be included as a default in Silverlight and at the very least have it templated.

 

 

 

Extensions: If you're really keen you could implement polling from the stub to detect when a new version is availalble and force a reload.