Silverlight – Caliburn Element Formula

While trying to learn the source code of the GameLibrary sample application, I saw a line like this:

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

Check the source of Caliburn, but I can’t really understand which element conventions.

Can anyone briefly describe ?

ConventionManager.AddElementConvention allows you to establish conventions for each type of element. A set of “defaults” used by the system Setting.

>In the above mentioned case, the first parameter value of Rating.ValueProperty tells the convention system what the default bindable property of this element is. Therefore, if we are in Rating. If there is a convention match on the control, we will set the binding for ValueProperty.
>The second parameter indicates the default property to be used in the Action binding. Therefore, if you create the action binding with the ElementName pointing to the Rating control, But the property is not specified, the Value property is returned.
>Finally, the thrid parameter represents the default event of the control. Therefore, if we attach an operation to the rating control, but do not specify an event to trigger the operation, the system will fall back to ValueChanged event.

These element conventions allow developers to provide as much information as possible in various situations, allowing the framework to fill in missing details in the appropriate places.

While trying to learn the source code of the GameLibrary sample application, I saw a line like this:

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

Check the source of Caliburn, but I can’t really understand which element conventions.

Can anyone briefly describe it?

ConventionManager.AddElementConvention allows you to establish conventions for each type of element. A set of “default” settings used by the system.

> In the case mentioned above, the first parameter value of Rating.ValueProperty tells the convention system what the default bindable property of the element is. Therefore, if we have a convention match on the Rating control, we will be ValueProperty Set the binding.
>The second parameter indicates the default property to be used in the Action binding. Therefore, if the action binding is created with the ElementName pointing to the Rating control, but no property is specified, the Value property is returned.
>Finally, the thrid parameter represents the default event of the control. Therefore, if we attach an operation to the rating control, but do not specify an event to trigger the operation, the system will fall back to the ValueChanged event.

These elements The convention allows developers to provide as much information as possible in various situations, allowing the framework to fill in missing details in the appropriate places.

Leave a Comment

Your email address will not be published.