I am trying to bind the Visible property of a MVVMCross Dialog Section.
var refillSection = new Section() {
new StringElement("Refill").Bind(this, "SelectedCommand OpenExternal")
}.Bind(this, "Visible IsExternal,Converter=Visibility");
root.Add(refillSection);
I have also tried binding the Visible of the Element directly, but does not work either.
var refillSection = new Section() {
new StringElement("Refill").Bind(this, "SelectedCommand OpenExternal;Visible IsExternal,Converter=Visibility")
};
root.Add(refillSection);
Am I doing something wrong? I have the Visibility plugin installed.
Visibleon the DialogElements is actually abool- see https://github.com/slodge/MvvmCross/blob/v3/CrossUI/CrossUI.Touch/Dialog/Elements/Element.cs#L71Because of this, you don't need to use any
Visibilityconverters when binding toVisible.Visibleitself was recently added to Dialog in this pull request - https://github.com/slodge/MvvmCross/pull/294As you may be able to see from the discussions on that request, there was some discussion there about how to extend
Visibleso that it worked forSections and even forRoot. However, sadly I don't think those discussions reached a successful implementation - so I don't believe that the defaultSectioncurrently works forVisible.For your specific well-understood scenario for showing/hiding one of your
Sections, then I think you might be able to implement this in your app by inheriting and overriding some functionality inSectionand possibly also theDialogViewController/DialogAdapterclasses. If it helps, one example ofSectioninheritance is theBindableSectionin https://github.com/slodge/MvvmCross-Tutorials/blob/master/DialogExamples/DialogExamples.Touch/BindableElements/BindableSection.cs