summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs
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.Phone/FormsPivot.cs
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.Phone/FormsPivot.cs')
-rw-r--r--Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs22
1 files changed, 3 insertions, 19 deletions
diff --git a/Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs b/Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs
index 68586abc..396888e6 100644
--- a/Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs
+++ b/Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs
@@ -22,8 +22,7 @@ namespace Xamarin.Forms.Platform.WinRT
CommandBar _commandBar;
#if WINDOWS_UWP
- Border _bottomCommandBarArea;
- Border _topCommandBarArea;
+ readonly ToolbarPlacementHelper _toolbarPlacementHelper = new ToolbarPlacementHelper();
#endif
TaskCompletionSource<CommandBar> _commandBarTcs;
ToolbarPlacement _toolbarPlacement;
@@ -53,7 +52,7 @@ namespace Xamarin.Forms.Platform.WinRT
{
_toolbarPlacement = value;
#if WINDOWS_UWP
- UpdateToolbarPlacement();
+ _toolbarPlacementHelper. UpdateToolbarPlacement();
#endif
}
}
@@ -75,26 +74,11 @@ namespace Xamarin.Forms.Platform.WinRT
_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;
tcs?.SetResult(_commandBar);
}
-
-#if WINDOWS_UWP
- void UpdateToolbarPlacement()
- {
- ToolbarPlacementHelper.UpdateToolbarPlacement(_commandBar, ToolbarPlacement, _bottomCommandBarArea, _topCommandBarArea);
- }
-#endif
}
} \ No newline at end of file