Nintex Form Object Model 2013: Render various types of properties
Goal: Requirement is to create the various types of properties like Textbox & checkbox and dropdown list in Nintex object model.
Background: To read about the Nintex forms object model, please read this blog.
Steps: To achieve above functionality only we required to work on the ControlProperties class. By taking the ref. with this blog Nintex forms object model.
The textbox already already implemented on the ref. post. So render the dropdown and check box only required to add the following lines of code in the ControlProperties class file. so below is the code
Background: To read about the Nintex forms object model, please read this blog.
Steps: To achieve above functionality only we required to work on the ControlProperties class. By taking the ref. with this blog Nintex forms object model.
The textbox already already implemented on the ref. post. So render the dropdown and check box only required to add the following lines of code in the ControlProperties class file. so below is the code
using Nintex.Forms;
using Nintex.Forms.FormControls;
using System.Collections.Generic;
using Nintex.Forms.Resources;
namespace CustomControl
{
public class ControlProperties : BaseBindableFormControlProperties
{
/*Render Text box list*/
[DataMember, ControlPropertyInfo(
DisplayName = "Display Text",
Description = "This is the text that will be displayed in your control.",
GroupName = NfConstants.CommonResourceStringNames.ControlPropertyGroupGeneral,
DisplayOrder = 10,
ChangeAction = ControlPropertyChangeActionType.RefreshFromServer,
IsPrimaryProperty = true,
AllowInsertReference = false
)]
public string DisplayText { get; set; }
/*Render Drop down list*/
[DataMember, ControlPropertyInfo(
DisplayName = "Color",
Description = "Select the color.",
GroupName = NfConstants.CommonResourceStringNames.ControlPropertyGroupGeneral,
DisplayOrder = 11,
ChangeAction = ControlPropertyChangeActionType.RefreshFromServer,
IsPrimaryProperty = true,
AllowInsertReference = false
)]
public OptionColor ColorOption { get; set; }
public enum OptionColor
{
[ControlPropertyInfo(ResourceType = typeof(Core), DisplayName = "Red", DisplayOrder = 3)]
Red = 0,
[ControlPropertyInfo(ResourceType = typeof(Core), DisplayName = "Yellow",DisplayOrder = 3)]
Yellow = 1,
[ControlPropertyInfo(ResourceType = typeof(Core), DisplayName = "Blue", DisplayOrder = 3)]
Blue = 2,
[ControlPropertyInfo(ResourceType = typeof(Core), DisplayName = "Pink", DisplayOrder = 3)]
Pink = 3
}
/*Render Checkbox list*/
[DataMember, ControlPropertyInfo(
DisplayName = "ReadOnly",
Description = "To check make the control to readonly.",
GroupName = NfConstants.CommonResourceStringNames.ControlPropertyGroupGeneral,
DisplayOrder = 12,
ChangeAction = ControlPropertyChangeActionType.RefreshFromServer,
IsPrimaryProperty = true,
AllowInsertReference = false
)]
public bool IsReadOnly { get; set; }
}
}
using Nintex.Forms.FormControls;
using System.Collections.Generic;
using Nintex.Forms.Resources;
namespace CustomControl
{
public class ControlProperties : BaseBindableFormControlProperties
{
/*Render Text box list*/
[DataMember, ControlPropertyInfo(
DisplayName = "Display Text",
Description = "This is the text that will be displayed in your control.",
GroupName = NfConstants.CommonResourceStringNames.ControlPropertyGroupGeneral,
DisplayOrder = 10,
ChangeAction = ControlPropertyChangeActionType.RefreshFromServer,
IsPrimaryProperty = true,
AllowInsertReference = false
)]
public string DisplayText { get; set; }
/*Render Drop down list*/
[DataMember, ControlPropertyInfo(
DisplayName = "Color",
Description = "Select the color.",
GroupName = NfConstants.CommonResourceStringNames.ControlPropertyGroupGeneral,
DisplayOrder = 11,
ChangeAction = ControlPropertyChangeActionType.RefreshFromServer,
IsPrimaryProperty = true,
AllowInsertReference = false
)]
public OptionColor ColorOption { get; set; }
public enum OptionColor
{
[ControlPropertyInfo(ResourceType = typeof(Core), DisplayName = "Red", DisplayOrder = 3)]
Red = 0,
[ControlPropertyInfo(ResourceType = typeof(Core), DisplayName = "Yellow",DisplayOrder = 3)]
Yellow = 1,
[ControlPropertyInfo(ResourceType = typeof(Core), DisplayName = "Blue", DisplayOrder = 3)]
Blue = 2,
[ControlPropertyInfo(ResourceType = typeof(Core), DisplayName = "Pink", DisplayOrder = 3)]
Pink = 3
}
/*Render Checkbox list*/
[DataMember, ControlPropertyInfo(
DisplayName = "ReadOnly",
Description = "To check make the control to readonly.",
GroupName = NfConstants.CommonResourceStringNames.ControlPropertyGroupGeneral,
DisplayOrder = 12,
ChangeAction = ControlPropertyChangeActionType.RefreshFromServer,
IsPrimaryProperty = true,
AllowInsertReference = false
)]
public bool IsReadOnly { get; set; }
}
}
Comments
Post a Comment