Search code examples
c#objective-ciosxamarin.iosstackpanel

Has anyone implemented a StackPanel equivalent using MonoTouch?


I miss WPF / Silverlight's auto-layout controls (like StackPanel and Grid) when writing the equivalent UI for iOS using MonoTouch.

I'm hoping that instead of reinventing the wheel, someone has already created these :-)

I've found a stackpanel for iOS github project but being a newbie to MonoTouch, I'm not sure how I would integrate the Obj-C code into the Mono project.


Solution

  • I've found a stackpanel for iOS github project

    The stackpanel code seems based on UITableView and offers a simpler API for a specific case.

    I'm not sure how I would integrate the Obj-C code

    In general you can compile existing objective-c into a library (using Xcode) and create managed bindings for it. However in this case the code looks quite small so it might even be easier to translate to C# (and provide an API closer to Silverlight's StackPanel).

    But I strongly suggest you to look at MonoTouch.Dialog which offers you a simpler API for tables, including support for owner-drawn elements. It's also very easy to extend (using C#) to create your own elements. See the Sample project to see them in action.