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.