Is it possible to do this? I need to use:
this.ControlName.DataBindings.Add (...)
so I can’t define logic other than bind my enum value to a bool.
For example:
(DataClass) Data.Type (enum)
EDIT:
I need to bind Data.Type which is an enum to a checkbox’s Checked property. So if the Data.Type is Secure, I want the SecureCheckbox to be checked, through data binding.
Winforms binding generates two important and useful events:
FormatandParse.The format event fires when pulling data from a source into a control and the Parse event fires when pulling data from a control back into the data source.
If you handle these events you can alter/retype the values going back and forth during binding.
For example here are a couple of example handlers for these events:
And here is some code attaching these event handlers:
So in your case you can just create a SecEnum to Bool handler for the format event and within that do something like:
and then reverse that during parse.