views:

132

answers:

1

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.

+1  A: 

Well if you are binding to your class you could always have a property on it like this:

public bool IsSecured
{
   get 
   {
      if (myEnum == SecEnum.Secured)
         return true;
      else 
         return false;
   }
}

Just reverse for the setter if needed.

Joshua Cauble
return (myEnum == SecEnum.Secured);
SwDevMan81
Thanks I did a similar one with INotifyPropertyChanged but it didn't work. Because I was changing the Data itself, the IsProperty wasn't signaled. I tried doing it myself, but that didn't help either.
Joan Venge