[Category("Data")] [Description("some description")] //TODO: add a description [DefaultValue(ALS.Terminator.Enums.TemperatureGlobal.Cold)] [RefreshProperties(RefreshProperties.Repaint)] public ALS.Terminator.Enums.TemperatureGlobal GlobalTemperature { get { ALS.Terminator.Enums.TemperatureGlobal ReturnValue; if (this.chkGlobalTemperature.Checked) { if (this.rbCold.Checked) { ReturnValue = ALS.Terminator.Enums.TemperatureGlobal.Cold; } else if (this.rbWarm.Checked) { ReturnValue = ALS.Terminator.Enums.TemperatureGlobal.Warm; } else if (this.rbHot.Checked) { ReturnValue = ALS.Terminator.Enums.TemperatureGlobal.Hot; } else { ReturnValue = ALS.Terminator.Enums.TemperatureGlobal.Cold; } } else { ReturnValue = ALS.Terminator.Enums.TemperatureGlobal.NotGlobal; } return ReturnValue; } set { switch (value) { case ALS.Terminator.Enums.TemperatureGlobal.Cold: this.chkGlobalTemperature.Checked = true; this.rbCold.Checked = true; break; case ALS.Terminator.Enums.TemperatureGlobal.Warm: this.chkGlobalTemperature.Checked = true; this.rbWarm.Checked = true; break; case ALS.Terminator.Enums.TemperatureGlobal.Hot: this.chkGlobalTemperature.Checked = true; this.rbHot.Checked = true; break; case ALS.Terminator.Enums.TemperatureGlobal.NotGlobal: this.chkGlobalTemperature.Checked = false; this.rbCold.Checked = true; break; default: this.chkGlobalTemperature.Checked = true; this.rbCold.Checked = true; value = ALS.Terminator.Enums.TemperatureGlobal.Cold; break; } this.EnableDisableControlControls(this.chkGlobalTemperature.Checked); } }Property for the object class (property of this.oFill):
public ALS.Terminator.Enums.TemperatureGlobal GlobalTemperature { get { return this.globalTemperature; } set { if (Enum.IsDefined(typeof(ALS.Terminator.Enums.TemperatureGlobal), value)) { this.globalTemperature = value; } else { throw new ArgumentException("Invalid Fill Step Global Temperature value (" + ((byte) value).ToString()+")."); } } }And here is the line that fails:
this.foTemperature.DataBindings.Add("GlobalTemperature", this.oFill, "GlobalTemperature");I hope this code explains things better than my previous writing.
>>>>this.fooUserControl.DataBindings.Add("UserControlProperty", this.fooObject, "ObjectProperty"); >>>>>>>>
>>>>System.ArgumentException: Object type cannot be converted to target type. >>>>>>>>