Question

In my Xamarin Studio project on Mac, I am using MvvmCross version 3.0.13 from MvvmCross-Binaries, the XS-iOS-Mac Release assemblies, and I am trying to couple my CrossUI Dialog based View with a corresponding ViewModel. Specifically, I define the Root in my dialog view like this:

var bindings = this.CreateInlineBindingTarget<ViewModel>();
Root = new RootElement("New Connection") {
  new Section {
    new StringElement("Test")
      .Bind(bindings, element => (object)element.SelectedCommand, vm => vm.TestConnection)
  },
  new Section {
    new StringElement ("Add")
      .Bind (bindings, element => element.Visible, vm => vm.CanAddConnection)
      .Bind (bindings, element => (object)element.SelectedCommand, vm => vm.AddConnection)
  }
};

In the ViewModel, CanAddConnection is set to true by the TestConnection command if test is successful.

When I run this (in the iOS Simulator) and open the dialog, the Test button is displayed and the Add button is hidden (as intended). When I click the button and the test is successful, the Add button is however not displayed, but instead I get this message in the application output:

How did this happen - CurrentAttachedCell is a child of a non-UITableView

Why is my Visible binding not working?


As far as I can tell, I have not made any code customizations upstream that would lead to this failure in the code (but I might be missing something).

If I bind CanAddConnection to another element property, for example Caption, the boolean value is properly updated in the view.

Was it helpful?

Solution

I think you are probably falling foul of an ios7 change which is addressed as part of https://github.com/MvvmCross/MvvmCross/issues/467

This fix will be included in 3.0.14 (hopefully in the next week) - in the meantime, the easiest workaround is probably to patch UpdateVisibility yourself in your own build - or to implement a custom StringElement

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top