This project is read-only.

Visual States in WinRT

Oct 7, 2013 at 8:43 AM
Hi Ian. I come to you through Sacha Barber.

I'm trying to get in touch with WinRT and I found some pretty annoying things like the fact that Styles doesn't have any Triggers collection. I used them (DataTrigger) to change the appearance of items according to data in the VM. The alternative (I think ) I the use of the Visual State Mananger. Unfortunately, in a pure MVVM approach, as I like to proceed, I haven't found any method to use Visual States elegantly and without cluttering my ViewModels.

So, before starting to use your Framework, I would like to know if you coined some method to deal with this issue.

Feel free to contact me. You can even add me to Skype. Username: SuperJMN.

I will be happy to help you if you need it.
Oct 7, 2013 at 2:34 PM
Hi SuperJMN,

As you pointed out Triggers aren't supported by WinRT, I haven't added anything to StyleMVVM to over come the limitation.

If you have an idea or a technique that you think would help overcome this limitation I'd be more than interested to add it.

Oct 7, 2013 at 3:03 PM
Thanks for your quick answer :)

As I told you, I have already talked to Sacha about the problem and I think there isn't a satisfactory way to do this. Maybe the base class for the ViewModel could have any property indicating its state, and according to it, some behavior could be attached to respond to the changes.

I will have to investigate more. Anyways, I would really love to contribute to the project. Cinch has been my framework of reference, but since it isn't kept in sync with the times and times have changed A LOT in only 2 years, I feel I will have to make a switch, and your project seems to be really good (I took a look at the code).

We can chat if you want via Skype or Facebook. It's really good to share opinions.

Count on me if you wish :)
Oct 7, 2013 at 4:34 PM
I'm always up for some help.

I had an idea a while back of allowing you to easily inject the ViewStateManager for a particular view into the associated ViewModel but I don't think I ever implemented it.

Your idea of defining properties that are then used to drive the view state is very intriguing. Possible something like you can attribute a property with [ViewState] it's would automatically be monitored for changes and drive the VSM.

For the moment I'm kinda pressed for time so email would work better for more (especially if you are in a different time zone) but at some point I'll have to setup skype and we can talk in person.

Let's take this discussion to email, you can contact me through codeplex directly or I can contact you.

As for cinch I know what you mean, I really like the framework and drew some good inspiration off of it. Sacha has been a very big help along the way, I usually bounce ideas off him to see if he likes them ... that and talking TV (Walking Dead and Breaking Bad)
Oct 7, 2013 at 7:47 PM
Hello again, Ian. Thanks for being so much responsive!

I would really like to improve your framework. In fact, I have my own version of Cinch since it lacked some features I really needed at work. I'm a die-hard MVVM purist. Feel free to write me an e-mail to "my CodePlex username" at

For the moment, all I can say is that an attribute adorning properties would be very clean.

It may be silly, but I have some ideas:
  1. View service (IVisualStateManager).
  2. An attached property with a Binding. That is pretty much the same the attribute you already mentioned.
  3. Some kind of property in the base implementation, although I don't like this approach very much…
Anyways, I will ask Sacha to see if he can shed some light into this. I know he hates Visual States, but we lost our beloved DataTriggers! I will see if I can find Glenn Block online tonight. He may turn the light on!

Best regards.