Skip to content
David-Desmaisons edited this page Nov 16, 2014 · 6 revisions

MVVM for Awesomium supports many scenarios:

Basic features

-Basic type such as string, int, double, decimal are transformed in their javascript equivalent.

-C# DateTime type is mapped to javascript dateTime.

-Enum is transfomed to custom javascript object containing two properties: intValue and displayName. intValue is the numeric value of the enum, displayName is the value of the Description attribute if any or the object.ToString() value.

-Complex object are mapped to javascript using reflection on public attributes.

-Tracking of property changes via INotifyPropertyChanges interface. This way changes in the ViewModel are reflected in the HTML View.

Collection support

-Tracking of collection changes is supported listening INotifyCollectionChanges interface. This way, any collection implementing this interface will be updated in the view when changing. This provides native integration with ObservableCollection.

Command support

-ICommand support via the custom command knockoutjs data-bind property that allows you for example to associate C# code excecution when clicking to a button.

Complex viewmodel supported

-Nested ViewModel fully supported

-One to one object mapping (that is if you have a same object referenced n times in your C# ViewModel, it will be mapped only one time and reference n times in the javascript session).

View to ViewModel update supported

-Changes in HTML View are propagated to ViewModel using knockoutjs subscription (both property and collection). This allows you for example to have a collection binding to the selected items in the HTML view that will bind to your ViewModelCollection.

Full working examples are provided in the MVVMAwesomium solution. See projects:

  • MVVMAwesomium.UI
  • MVVMAwesomium.UI.Calendar
  • MVVMAwesomium.UI.SelectedItems
  • MVVMAwesomium.UI2