Editing UI Frame properties directly don't seem to work.
i.e.
scrollView.ContentSize.Width = 100;
doesn't work but
RectangleF scrollFrame = ScrollView.Frame;
scrollFrame.Width = width * pageCount;
ScrollView.ContentSize = scrollFrame.Size;
does! Why is this? Isn't Monotouch supposed to protect against arcane programming styles?
This is basic C# behavior.
The ContentSize property is a SizeF which is a struct (=value type) and not a class (=reference type).
Calling
does not work because you are setting a value on a property of a copied object.
Calling
works because although RectangleF is also a struct, you are setting a value on the actual object.
Likewise,
creates a copy, but sets a new object after the '=' and works correctly.