The Wpf dynamic user interface is all about model discovery and control builders.

The application reflects the actual DataContext and building the user interface based on conventions and DataAnnotation attributes.

 

How the discovery is working:

The application is discovering all public properties, all public methods and all public static methods. By default there is no need to use any attributes to start up with a working interface. The only requirement for the methods and properties are to be declared as public…

  • Public properties are built as detail controls.
  • Public instance methods are built as contextual buttons
  • Public static methods are built as module buttons.

 

Discoverable properties

The discovered properties are handled with a registered control builder.

The actual control builder is building the control with all the bindings and settings therefore providing the control ready to be displayed on the screen.

Currently the the following types have a specified control builder.

 

Simple .NET property types

Simple property type control builders are accepting the property type as declared. These types are in a lookup dictionary and sub-classing these property types are not handled by the control builder.

  • string
  • int, int?
  • decimal, decimal?
  • double, double?
  • DateTime, DateTime?
  • TimeSpan, TimeSpan?
  • Boolean, Boolean?
  • System.Drawing.Image

Inherited property types

Inherited property type control builders are accepting the property type when the actual type is assignable from the type list below.

  • System.Window.Controls.Control
  • IPagedQueryable
  • IEnumerable
  • INotifyPropertyChanged

 

Method discovering

Method discovery provides the ability to display buttons for the actual model. By default all methods are discovered either static and instance methods. The differencees of the static and instance methods are described below.

The methods can have Condition property attached. Condition properties are for setting the enabled/disabled state of the generated button.

The method control builder is building the button with all the bindings and settings therefore providing the button ready to be displayed on the screen.

Contextual methods

  • All methods declared as public instance without parameter are discovered

Contextual methods have built in Condition convention.

Assuming a discovered method with name of DeleteCustomer valid method condition properties are

  • CanDeleteCustomer
  • DeleteCustomerCondition
  • DeleteCustomerIsEnabled
  • DeleteCustomerEnabled
  • All methods declared as public instance method with one parameter are discovered.

The button is generated only when the method parameter is assignable from the actual model. Therefore it is possible to set up contextual workflow.

As an example: Opening CustomerPurchase model method is accessible from the EditCustomer model.

 

Static methods

All static methods declared as public parameterless method are discovered.

Static parameterless methods are always treated as application menu items.

 

Where to start

Check out the quickstart guides.

 

Want to know more?

Check the in deep details

Last edited Apr 15, 2012 at 7:32 PM by csizo, version 9

Comments

No comments yet.