Navigation to sub pages in a TableView

FredrikHaglundFredrikHaglund SEUniversity, Developer Group Leader ✭✭

Hi!

With a TableView using different built-in Cells classes can take you a long way to build a Settings page or a Menu.

Looking at MonoTouch.Dialog you can nest RootElement to create a hierarchy with navigation.

What is the best approach today with Xamarin.Forms 1.3 to replicate this behaviour? Just implement Click and Push another Page onto the Navigation Stack?

Any shortcut to get the built-in arrow icons on iOS indicating that you can click on the item to reveal more? Or do you have to implement your own Renderer and a custom Cell?

Screenshot of MonoTouch.Dialog

Best Answer

Answers

  • MarkSmith.8123MarkSmith.8123 USXamarin Team, University, XamUProfessors Xamurai

    Hi @FredrikHaglund,

    The TableView is a great way to implement this style of visualization, it's essentially a slimmed down version of MonoTouch.Dialog for Xamarin.Forms. I built a quick and dirty sample using three Pages (each with a TableView) to display settings. To really create a full example, you'd probably need a couple of custom cells (there's no SliderCell for example).

    As René suggests, you need a custom TextCellRenderer which adds the DisclosureIndicator on iOS. I'm cheating a little and using the StyleId property set to a known value which I look for in the renderer so I don't have to create my own TextCell - particularly since this is such a minor change. You could certainly implement both sides if you want to - the same principles apply.

    Here's the code if you want to play with it:

    https://dl.dropboxusercontent.com/u/2174873/Xamarin.Samples/TVExample.zip

    Good luck!

    Mark Smith
    Xamarin University | Curriculum

Sign In or Register to comment.