torsdag 28. april 2011

MonoTouch.Dialog and sqlite-net not working together

MonoTouch.Dialog requires you to have all your fields as public fields (or else it will try to show your backing fields of your properties) while sql-lite wants properties to be able to use a class as a binding context.

The solution is very simple, just edit your MonoTouch.Dialog source code and change the method below to not include private fields when doing the reflection:

void Populate (object callbacks, object o, RootElement root)
  {
   MemberInfo last_radio_index = null;
   var members = o.GetType ().GetMembers (BindingFlags.DeclaredOnly | BindingFlags.Public |
               BindingFlags.Instance);