The main difference with Silverlight is one big thing.

Silverlight doesn't support data binding with the dynamic type...  Well does that mean NoMvvm is broken?

Well, luckily Silverlight 4 does support binding to indexers such as this["MyIndex"].

To remedy this, I modified the base ViewModel class for Silverlight, and all bindings must be done like so:

<TextBox Text="{Binding [Woot]}" />

Any bindings done to a dynamic property on a NoMvvm.ViewModel have to be bound this way.  Silverlight 5 is reported to remedy this, see here on that.

This would bind to an indexer passing the string "Woot" as a key, with INotifyPropertyChanged still working as expected.  To raise the property changed event, the ViewModel base class has to raise an additional property changed event with an empty string as a property name.  This could affect performance slightly, so I don't support indexer bindings with the WPF version of NoMvvm.

If you want to use indexer bindings in WPF for some reason, please let me know.  There may be a good use for it, but all I could think of off the top off my head is the ability to put a space or some other strange character in the property name.

Last edited Aug 24, 2011 at 4:06 AM by jonathanpeppers, version 2

Comments

No comments yet.