I am developing a custom control and written properties like Visible and Enabled in Definition.xml as shown below.
<Prop ID="IsVisible" friendlyname="Visible" type="bool" category="General" refreshdisplay="true"><Value>true</Value></Prop><Prop ID="IsEnabled" friendlyname="Enabled" type="bool" category="General" refreshdisplay="true"><Value>true</Value></Prop>
...and the code behind Control.cs goes like this:
public bool IsVisible{get { return this.GetOption<bool>("isvisible", true); }set { this.SetOption<bool>("isvisible", value, true); }}public bool IsEnabled{get { return this.GetOption<bool>("isenabled", true); }set { this.SetOption<bool>("isenabled", value, true); }}
in Control.js file, i have the get ans set methods written as below.
getProperty: function (objInfo) {if (objInfo.property.toLowerCase() == "value") {return Control.getValue(objInfo);}else {return $('#' + objInfo.CurrentControlId).data(objInfo.property);}},setProperty: function (objInfo) {switch (objInfo.property.toLowerCase()) {case "width":Control.setWidth(objInfo.Value);break;case "height":Control.setHeight(objInfo.Value);break;case "style":Control.setStyles(null, objInfo.Value, $('#' + objInfo.CurrentControlId));break;case "value":Control.setValue(objInfo);break;case "isvisible":Control.setIsVisible(objInfo);break;case "isenabled":Control.setIsEnabled(objInfo);break;default:$('#' + objInfo.CurrentControlId).data(objInfo.property).value = objInfo.Value; //set default property}},
The control is showing fine with default options like Visible and Enabled Checked. The issue is when i change the state of those, nothing is happening. Where am i going wrong? How to make these properties work as like normal controls?