Update - MvvmCross iOS from storyboard - TableViewCell not showing

I am trying to display a table view which cells have labels visible in it. I ran MvvmCross N + 1 days with N = 3 to create this sample.

Table is displayed, but the label is not displayed

I have MvxTableViewController

partial class View : MvxTableViewController
{
    public View (IntPtr handle) : base (handle)
    {
    }

    public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();

        var source = new MvxSimpleTableViewSource (TableView, typeof(CellView), "CellView");
        TableView.Source = source;
        var set = this.CreateBindingSet<View,ViewModel> ();
        set.Bind (source).To (vm => vm.CellViewModels);
        set.Bind (source).For (s => s.SelectionChangedCommand).To (vm => vm.ViewCommand);
        set.Apply ();

        TableView.ReloadData ();
    }
}

      

and MvxTableViewCell with label in it

partial class CellView : MvxTableViewCell
{
    public CellView (IntPtr handle) : base (handle)
    {
        this.DelayBind (() => {
            var set = this.CreateBindingSet<CellView, CellViewModel>();
            set.Bind(cellLabel).To(vm => vm.TextToDisplay);
            set.Apply();
        });
    }
}

      

As I said, the table view is displayed, but the label is not displayed in the cell. I can click on a table view and navigate to another view by binding the command to my view model.

I get the following warning in the log

MvxBind:Warning: 13.35 Failed to create target binding for binding Text for TextToDisplay

      

I don't understand this as the binding code looks good to me!

There is one difference in the code from N + 1 N = 3 videos is that I use the following code to create the view source as I don't have nib / xib

var source = new MvxSimpleTableViewSource (TableView, typeof(CellView), "CellView");

      

where "CellView" is the identifier entered in the properties of the prototype cell

This could be a problem. I must also say that I am using Xamarin Studio on Mac.

Please help me to bang my head about this for a few hours.

Update - I had to abandon the use of storyboards due to the fast approach to deadlines. Back to using xibs for views and cells. If anyone resolves this issue please post your answer

0


source to share





All Articles