I\'m using Xamarin and mvvmcross and what to have a view with a table ultimately bound to an observable collection.
This video is very informative on how to create cust
The available v3 table sources are:
Abstract classes
ItemsSource
- generally not used directlyItemsSource
for data-bindingprotected abstract UITableViewCell GetOrCreateCellFor(UITableView tableView, NSIndexPath indexPath, object item);
Concrete classes
MvxTableViewSource
UITableViewCellStyle
TitleText
, DetailText
, ImageUrl
and (with some teasing) AccessoryMvxTableViewSource
string nibName
in the ctor
Func<>
style hooks to allow you to implement GetOrCreateCellFor
without inheriting a new class from MvxTableViewSource
Generally I use:
MvxStandardTableViewSource
- because I get a list without having to create a custom cellMvxSimpleTableViewSource
when I only need one cell typeMvxTableViewSource
when I need multiple cell types - e.g. see belowA general TableSource with multiple cell types typically looks like PolymorphicListItemTypesView.cs:
public class PolymorphicListItemTypesView
: MvxTableViewController
{
public PolymorphicListItemTypesView()
{
Title = "Poly List";
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
var source = new TableSource(TableView);
this.AddBindings(new Dictionary
This video is very informative on how to create custom cells, but appears to be out-of-date
It was made just pre-Xamarin 2.0 and pre-V3 but the principles are very similar.
The code for that article has been updated - see https://github.com/slodge/MvvmCross-Tutorials/tree/master/MonoTouchCellTutorial
Beyond that:
there's a lot of demos of table use in the N+1 series - indexed at http://mvvmcross.wordpress.com
the "Working with Collections" sample has quite a lot of Table and List code - https://github.com/slodge/MvvmCross-Tutorials/tree/master/Working%20With%20Collections
tables are used during the Evolve presentation - http://xamarin.com/evolve/2013#session-dnoeeoarfj
there are other samples available - see https://github.com/slodge/MvvmCross-Tutorials/ (or search on GitHub for mvvmcross - others are also posting samples)
Also, I'm using a UITableView in a regular MvxViewController because I can't seem to get the MvxTableViewController to work with a xib, which this question seems to suggest isn't currently possible.
I think that has since been fixed - see MvxTableViewController.cs#L33