Create Custom Properties
- Last UpdatedNov 24, 2023
- 1 minute read
Create a custom property to define a new property.
To create a custom property
-
Create a class property with a getter and setter section along with the user defined logic.
-
Decorate the class property with the DesignerProperty property attribution.
(For more information, see Designer Property in Attributing Properties.)
// Setting the location of the custom property
// in the Behaviour tab of the Property page.
[DesignerProperty(773000, Categories.Behaviour, CoreDesigner.NextGenDesigner)]
OR
[DesignerProperty(773000, Categories.Behaviour, typeof(GridProperty), "DataFormXml")]
-
If you want the custom property to be a part of the View Model, then you must decorate the class property with the BindingAttribute property attribution.
/ Custom binding is defined under IntegerBindingProperty class
// located at Skelta.Forms.Core.CommonObjects.IntegerBindingProperty class path.
[BindingAttribute(882995, "Skelta.Forms.Core.CommonObjects.IntegerBindingProperty")]
-
Provide a default value for the custom property, if required, by decorating the class property with the DefaultValue property attribution.
Example
private string _step = "0";
/// <summary>
/// Get/set the step value for the slider.
/// </summary>
[DefaultValue("1")]
[DesignerProperty(775000, Categories.Behaviour, CoreDesigner.NextGenDesigner)]
[BindingAttribute(882998, EFormMode.NextGenMode, "Skelta.Forms.Core.CommonObjects.IntegerBindingProperty")]
public string Step
{
get { return _step; }
set
{
_step = value;
}
}