Reconcile Caliburn Elements

When I tried to study the source code for an example GameLibrary application, I saw a line like this:

ConventionManager.AddElementConvention<Rating>(Rating.ValueProperty, "Value", "ValueChanged"); 

I looked at the source of Caliburn, but could not understand what the legend was.

Can someone describe for a while?

+4
source share
1 answer

ConventionManager.AddElementConvention allows you to set a set of “standard” settings used by the conventions for each type element.

  • In the aforementioned case, the first value of the Rating.ValueProperty parameter tells the legend system that the default binding property for the item. So, if we have a correspondence between the agreement and the Rating control, we set the binding to ValueProperty .

  • The second parameter is the default property that will be used in Action bindings. So, if you create an action binding with an ElementName that points to the Rating control but does not specify a property, we return to the Value property.

  • Finally, the thrid parameter represents the default event for the control. So, if we attach the action to the rating control, but do not specify an event to trigger this action, the system returns to the ValueChanged event.

These element conventions allow the developer to provide as much or small information as possible in various situations, allowing the structure to fill in the missing details as appropriate.

+7
source

All Articles