Lakana WPF Forms is a part of Lakana Framework (the other part being Lakana WPF Navigation).
It is a lightweight framework that aims to offer you very useful features when implementing editable data forms using Windows Presentation Foundation and the Model View View-Model (MVVM) design pattern.

The WPF/MVVM combination has become the mainstream nowadays.
Despite this fact, developing applications that uses forms to edit data (that is the case for many line of business applications), is still tedious. Managing things like field validation, validation rule definition on fields or dynamic localization of texts, can become a nightmare especially if you want more advanced features such as asynchronous validation or the ability to define more complex validation rules.

Lakana WPF Forms fills this gap by offering you the basic and common features that you can leverage in your application.

Features

  • Rich view model properties.
  • UI localization made easier.
  • Asynchronous validation on fields.
  • Three validation engines for fields: Data annotations, Fluent Validation API or Custom.

Rich view model properties

Lakana relies on special rich properties abstracted by the IViewModelProperty interface, in order to enforce features like property value change detection, error notifications and so forth.
View model properties are kind of rich properties in sense that they contain more than just the property value. In fact, each View model property will wrap each property of your model to make them more “UI friendly”.

Ease UI Localization

UI metadata (represented by IUIMetadata interface) are associated with View model properties. They are used to put things like field descriptions, labels or icons. IUIMetadata facilitates the localization of the UI.

Asynchronous validation of fields

To validate a property and display error notifications, developers are used to choose either implementing IDataErrorInfo interface or attaching ValidationRule object on their bindings.
These two approaches are synchronous, meaning your validation code should execute very quickly to avoid blocking the UI. For cases where the validation process can take longer (for instance if you have to ask to some web service for existence or not of the current value), an asynchronous approach is preferable.
Lakana natively supports both synchronous and asynchronous validation of fields.

Validation Engines

The built-in validation engines allow to define validation rules and to validate field’s value. They also support both synchronous and asynchronous validation of the form.
In WPF, you have two choice as far as form validation is concerned : per-field validation or batch validation.
Lakana implements per-field validation, meaning the validation process take place every time you change the value of a field.

  • Data annotations

Data annotations are part of the .NET framework, and they are used to enforce validation rules on object properties.
They are cool and powerful but unfortunately, were not designed natively to work with WPF. However Lakana again fills this gap. All you have to do is to define data annotations attribute on your view model properties and that’s all, the framework will manage the validation for you.

  • Fluent Validation API

Fluent APIs have gained in popularity in recent years. To allow you to gain in clarity and expressiveness for your form validation rules declaration, Lakana offers a built-in Fluent API. The fluent syntax will improve significantly the readability of your code. Furthermore,  you will be able to write rules that involve many properties or asynchronous operations.

  • Custom validation

If any of the previous validation engines do not fit your needs, you can just implement your own. You can inherit from ValidationEngineBase class. You still can benefit the ability to make a synchronous or asynchronous validation.

Conclusion

Data Forms edition is not a trivial things to implement with WPF. This framework aims to lighten the repetitive task of implementing such kind of things and to resolve some tricky problem like asynchronous validation.

Last edited Sep 11, 2012 at 7:52 PM by gasytek, version 13

Comments

No comments yet.