Bug 3970 - MT.Dialog with multiple BooleanImageElements - not all elements respond
Summary: MT.Dialog with multiple BooleanImageElements - not all elements respond
Alias: None
Product: iOS
Classification: Xamarin
Component: General (show other bugs)
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
Depends on:
Reported: 2012-03-19 12:24 UTC by Jason Awbrey
Modified: 2012-03-20 14:12 UTC (History)
3 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:

sample project illustrating problem with BooleanImageElement (16.79 KB, application/x-zip-compressed)
2012-03-19 12:24 UTC, Jason Awbrey

Description Jason Awbrey 2012-03-19 12:24:05 UTC
Created attachment 1540 [details]
sample project illustrating problem with BooleanImageElement

MD, Mono 2.10.9, MT 5.2.5, Lion with latest XCode and 5.1.0 SDK

I have a project (sample attached) that uses MT.D to display a series of questions with a YES/NO selection using BooleanImageElement.

1. run the project in landscape
2. the first 5 bools are clickable, the sixth is not
3. scroll back up - now the first is not clickable
4. scroll up and down, randomly clicking cells - cell responsiveness changes as the scroll on and off the screen.  Some cells seem to be drawn based on the state of other cells.
Comment 1 Sebastien Pouliot 2012-03-19 19:50:56 UTC
Yup, caching is buggy. Adding a C.WL in the tap event show:

Parent False : a.
Parent False : b.
Parent False : c.
Parent False : d.
Parent False : e.
Parent True : a.

when tapping on each question, last show be "Parent False : f."
Comment 2 Sebastien Pouliot 2012-03-19 20:23:23 UTC
there was a typo between 'this.parent' (field) and 'parent' (parameter) when creating the cell and that fixed the button to the original parent

If you want to build your MT.D from (github) sources you can apply this fix.

$ git diff
diff --git a/MonoTouch.Dialog/Elements.cs b/MonoTouch.Dialog/Elements.cs
index bda8ccb..91492d2 100644
--- a/MonoTouch.Dialog/Elements.cs
+++ b/MonoTouch.Dialog/Elements.cs
@@ -342,9 +342,9 @@ namespace MonoTouch.Dialog
                        const int ImageSpace = 32;
                        const int Padding = 8;
-                       public TextWithImageCellView (BaseBooleanImageElement parent) : base (UITableViewCellStyle.Value1, parent.CellKey)
+                       public TextWithImageCellView (BaseBooleanImageElement p) : base (UITableViewCellStyle.Value1, p.CellKey)
-                               this.parent = parent;
+                               parent = p;
                                label = new UILabel () {
                                        TextAlignment = UITextAlignment.Left,
                                        Text = parent.Caption,
Comment 3 Jason Awbrey 2012-03-20 10:31:13 UTC
thanks for the quick response and workaround
Comment 4 Miguel de Icaza [MSFT] 2012-03-20 14:12:14 UTC
Will be on the next release.

Note You need to log in before you can comment on or make changes to this bug.