diff options
Diffstat (limited to 'Xamarin.Forms.Platform.UAP/ToolbarPlacementHelper.cs')
-rw-r--r-- | Xamarin.Forms.Platform.UAP/ToolbarPlacementHelper.cs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.UAP/ToolbarPlacementHelper.cs b/Xamarin.Forms.Platform.UAP/ToolbarPlacementHelper.cs index 1b36010a..0985cc3f 100644 --- a/Xamarin.Forms.Platform.UAP/ToolbarPlacementHelper.cs +++ b/Xamarin.Forms.Platform.UAP/ToolbarPlacementHelper.cs @@ -26,7 +26,11 @@ namespace Xamarin.Forms.Platform.UWP { // We have to wait for the command bar to load so that it'll be in the control hierarchy // otherwise we can't properly move it to wherever the toolbar is supposed to be - _commandBar.Loaded += (sender, args) => UpdateToolbarPlacement(); + _commandBar.Loaded += (sender, args) => + { + UpdateToolbarPlacement(); + UpdateIsInValidLocation(); + }; } } @@ -90,5 +94,28 @@ namespace Xamarin.Forms.Platform.UWP } } } + + // For the time being, keeping this logic for dealing with consistency between the platforms + // re: toolbar visibility here; at some point we should be separating toolbars from navigation bars, + // and this won't be necessary + bool _shouldShowToolBar; + public bool ShouldShowToolBar + { + get { return _shouldShowToolBar; } + set + { + _shouldShowToolBar = value; + UpdateIsInValidLocation(); + } + } + + void UpdateIsInValidLocation() + { + var formsCommandBar = _commandBar as FormsCommandBar; + if (formsCommandBar != null) + { + formsCommandBar.IsInValidLocation = ShouldShowToolBar; + } + } } }
\ No newline at end of file |