summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-12-02 13:48:42 -0700
committerRui Marinho <me@ruimarinho.net>2016-12-02 20:48:42 +0000
commit4df66d139f8128486b3e34e1c206413abd1babd5 (patch)
tree3a7e1581240872ce3fff0559524cc6092d45014f /Xamarin.Forms.Platform.WinRT
parentbadc701871a1190d6acb3495d3cefa93cff810c5 (diff)
downloadxamarin-forms-4df66d139f8128486b3e34e1c206413abd1babd5.tar.gz
xamarin-forms-4df66d139f8128486b3e34e1c206413abd1babd5.tar.bz2
xamarin-forms-4df66d139f8128486b3e34e1c206413abd1babd5.zip
Allow CommandBar to expand and show command labels (#594)
* Allow CommandBar to expand and show command labels Consolidate command bar placement code * Make title text wrapping consistent between NavigationPage and MasterDetailPage * Align toolbar/navigation bar behavior with other platforms
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT')
-rw-r--r--Xamarin.Forms.Platform.WinRT/PageControl.xaml.cs25
1 files changed, 5 insertions, 20 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/PageControl.xaml.cs b/Xamarin.Forms.Platform.WinRT/PageControl.xaml.cs
index a57b6749..8d00371f 100644
--- a/Xamarin.Forms.Platform.WinRT/PageControl.xaml.cs
+++ b/Xamarin.Forms.Platform.WinRT/PageControl.xaml.cs
@@ -41,11 +41,10 @@ namespace Xamarin.Forms.Platform.WinRT
#if WINDOWS_UWP
ToolbarPlacement _toolbarPlacement;
- Border _bottomCommandBarArea;
- Border _topCommandBarArea;
+ readonly ToolbarPlacementHelper _toolbarPlacementHelper = new ToolbarPlacementHelper();
#endif
- TaskCompletionSource<CommandBar> _commandBarTcs;
+ TaskCompletionSource<CommandBar> _commandBarTcs;
Windows.UI.Xaml.Controls.ContentPresenter _presenter;
@@ -95,7 +94,7 @@ namespace Xamarin.Forms.Platform.WinRT
set
{
_toolbarPlacement = value;
- UpdateToolbarPlacement();
+ _toolbarPlacementHelper.UpdateToolbarPlacement();
}
}
#endif
@@ -147,16 +146,9 @@ namespace Xamarin.Forms.Platform.WinRT
_presenter = GetTemplateChild("presenter") as Windows.UI.Xaml.Controls.ContentPresenter;
_commandBar = GetTemplateChild("CommandBar") as CommandBar;
+
#if WINDOWS_UWP
- _bottomCommandBarArea = GetTemplateChild("BottomCommandBarArea") as Border;
- _topCommandBarArea = GetTemplateChild("TopCommandBarArea") as Border;
-
- if (_commandBar != null && _bottomCommandBarArea != null && _topCommandBarArea != null)
- {
- // 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();
- }
+ _toolbarPlacementHelper.Initialize(_commandBar, () => ToolbarPlacement, GetTemplateChild);
#endif
TaskCompletionSource<CommandBar> tcs = _commandBarTcs;
@@ -192,12 +184,5 @@ namespace Xamarin.Forms.Platform.WinRT
_backButton.Opacity = ShowBackButton ? 1 : 0;
}
-
-#if WINDOWS_UWP
- void UpdateToolbarPlacement()
- {
- ToolbarPlacementHelper.UpdateToolbarPlacement(_commandBar, ToolbarPlacement, _bottomCommandBarArea, _topCommandBarArea);
- }
-#endif
}
} \ No newline at end of file