migueldeicaza / MonoTouch.Dialog

Tools to simplify creating dialogs with the user using MonoTouch
MIT License
431 stars 211 forks source link

BooleanElement don't updates the UISwitch when you change the value programmatically. Previous Issue #44 #84

Closed tanwarsatya closed 12 years ago

tanwarsatya commented 12 years ago

It's interesting to see that this bug which was closed earlier is still not fixed, might be because the code has been re written or whatever.. Fix need to be applied in repository

Two changes were needed

  1. Made value as virtual in BoolElement Class

public virtual bool Value

  1. Added override for value in BooleanElement public override bool Value { get { return base.Value; } set { base.Value = value; if(value) { sw.On = true; } else { sw.On = false; } } }
migueldeicaza commented 12 years ago

Fixed; The above has a small problem: sw could be null.