Features at a Glance
Calcium's core features allow you to accelerate your development of MVVM applications. Here are some of Calcium's features:
Enhanced Commanding Support
The Calcium ICommand implementation uses parameter type value coercion. Enum types, for example, can be used as command parameters in XAML, and they are converted to the correct type for you by the time they hit your viewmodel. That means you can leverage Generic ICommands in XAML and you don’t need to make assumptions or perform type conversion of parameter values. This work was inspired by Pete Blois terrific work on implicit type coercion.
UICommands offer Visibility, Text and Icon properties that can be changed according to the logic that can be encapsulated by the command logic. They also work in unison with a number of controls, including Calcium’s AppBar for Xamarin Forms, and Calcium’s User Options system. You see examples of these features in a number of the upcoming articles.
Frictionless INotifyPropertyChanged (INPC) Infrastructure
Calcium’s INPC system has automatic UI thread affinity. Modifying a property in a viewmodel (an ObservableObject) from a non-UI thread automatically raises a property changed event on the UI thread if necessary. In addition, the PropertyChangeNotifier can be applied to any class and makes use of weak referencing to prevent memory leaks. In addition, a PropertyChanging event is raised before the PropertyChanged event to give other components a chance to cancel the change.
Calcium’s setting service allows you to save settings on whatever platform your app is running. It includes notifications that allow you to cancel setting changes, and to be notified before a setting change takes place. It also provides the means to serialize values, composite objects, or even to customize the serialization of objects via an IXmlConvertible interface.
Calcium’s options system enables you to quickly create a user options page for your app. Categorized options can be added with a single line of code. Templates control how types of options are displayed. The options system works in unison with the settings service to automatically write changes back to persistent storage.
Inversion of Control and Dependency Injection
Calcium includes a built-in IoC container supporting Dependency Injection; attribute based constructor and property injection, and which is also interchangeable. If Calcium’s IoC container or Microsoft Unity don’t fit the bill, you can create adapters for whatever implementation you’d like to use.
Cross-Platform Dialog Service
Calcium’s DialogService has an asynchronous API, implemented for each platform with an extensibility model that allows you to present dialogs to the user and easily receive user feedback.
Extensible String Parser
Calcium includes an extensible String Parser service for which you can create recognizable tags that are processed at run-time to insert information in to a string. This offers the ability to create dynamic localizable strings.
An Undo Redo Stack for your App
Calcium includes an undo redo task system, which gives the user of your app the ability to undo an action, or redo that action.
Weak Referencing Messaging System
The weak referencing messaging system, known as the Messenger, uses a declarative interface based approach that allows an object to be notified of an event from another component within the app. A set of standard message classes are included that allow you to send payload objects to listeners, or to even cancel a message.
Collections, such as an ObservableList
Calcium includes collections such as the ObservableList that allow you to postpone collection changed events to perform bulk updates, without causing multiple updates to UI controls and slowing the UI thread.
Input Validation System
Calcium includes an attribute based asynchronous input validation system that allows you to easily validate forms. I have not yet created the UI for visualising validation error in Xamarin Forms.
ViewModel State Persistence System
Calcium allows you to maintain the state of your application across tombstoning (Windows Phone) using an attribute based system or a programmatic property registration system. I have not yet wired this up for Xamarin Forms.
Most of this infrastructure can now be leveraged on Windows, Windows Phone, and thanks to Xamarin iOS and Android. This series of articles covers what is in Calcium and is a preview of what is inevitability coming to Calcium for Xamarin Forms.