summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT.Phone
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-08-30 10:46:14 -0700
committerJason Smith <jason.smith@xamarin.com>2016-08-30 10:46:14 -0700
commit5e553f6195e66e48688b8ab324f1bab1e9251f0a (patch)
treef8843e5e9e8afe89a05a1cc91c3b7fa05588bac7 /Xamarin.Forms.Platform.WinRT.Phone
parentf551654b1cfe654c579ca50978445e7cb93f287d (diff)
downloadxamarin-forms-5e553f6195e66e48688b8ab324f1bab1e9251f0a.tar.gz
xamarin-forms-5e553f6195e66e48688b8ab324f1bab1e9251f0a.tar.bz2
xamarin-forms-5e553f6195e66e48688b8ab324f1bab1e9251f0a.zip
Platform Specifics (#301)
* Playing around with how the platform specifics interfaces etc. might work * Sample implementation of iOS navigation translucency * Very slightly reduced code * Better vendor stuff * Drop single-implemenation interfaces * Generics on NavigationPage * On-demand vendor stuff * Remove functionally duplicate classes and make ControlGallery work again * Namespace all the things. XAML test. * Can use Effect to attach platform specific * Attach Effect on PropertyChanging for XAML support! * Rename IConfigPlatform interfaces for readability * Some renaming to match the documents * Split class files * Clear out test-only code * Re-namespace * Added On method to rendered Elements * Allow for removal of platform suffix, convenience methods on specific platforms * Creating a gallery page for specifics * Add rudimentary Platform Specifics gallery; make CollapseStyle work on UWP; Add CollapsedPaneWidth specific property * Toolbar now working with both collapse styles * MDP now displaying Content title; toolbar routing around title * Add a gallery for the iOS NavigationPage stuff * Add Navigation Page as detail page to verify it works with new Toolbar options * Make titlebar/toolbar background colors consistent * ToolbarPlacement now working on NavigationPage * Toolbar Placement working for tabbed and nav pages * Fix bug where phone doesn't get default toolbar placement on start * [Core] Add PS WindowSoftInputModeAdjust [Core] Make Application extendable * Toolbar placement now working on Nav, Tabbed, and Master pages on desktop/phone Remove unnecessary style indirection Fix build errors * [A] Add PlatformConfigurationExtensions * SetSoftInputMode test page * [A] SetSoftInputMode Known issue: Status bar color does not work in AdjustResize mode * [Core] Add PS Blur * [iOS] Configure renderer for blur * Add test page * Move to blur VisualElement for broader support * Move test pages to gallery * Update docs * Use lazy initializer for PlatformConfigurationRegistry
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT.Phone')
-rw-r--r--Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs49
-rw-r--r--Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml3
-rw-r--r--Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs2
3 files changed, 42 insertions, 12 deletions
diff --git a/Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs b/Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs
index a2e765b3..b06acb1f 100644
--- a/Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs
+++ b/Xamarin.Forms.Platform.WinRT.Phone/FormsPivot.cs
@@ -2,6 +2,7 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
+using Xamarin.Forms.PlatformConfiguration.WindowsSpecific;
#if WINDOWS_UWP
@@ -12,7 +13,7 @@ namespace Xamarin.Forms.Platform.WinRT
{
public class FormsPivot : Pivot, IToolbarProvider
{
- public static readonly DependencyProperty ToolbarVisibilityProperty = DependencyProperty.Register(nameof(ToolbarVisibility), typeof(Visibility), typeof(FormsPivot),
+ public static readonly DependencyProperty TitleVisibilityProperty = DependencyProperty.Register(nameof(TitleVisibility), typeof(Visibility), typeof(FormsPivot),
new PropertyMetadata(Visibility.Collapsed));
public static readonly DependencyProperty ToolbarForegroundProperty = DependencyProperty.Register(nameof(ToolbarForeground), typeof(Brush), typeof(FormsPivot), new PropertyMetadata(default(Brush)));
@@ -20,10 +21,14 @@ namespace Xamarin.Forms.Platform.WinRT
public static readonly DependencyProperty ToolbarBackgroundProperty = DependencyProperty.Register(nameof(ToolbarBackground), typeof(Brush), typeof(FormsPivot), new PropertyMetadata(default(Brush)));
CommandBar _commandBar;
-
+#if WINDOWS_UWP
+ Border _bottomCommandBarArea;
+ Border _topCommandBarArea;
+#endif
TaskCompletionSource<CommandBar> _commandBarTcs;
+ ToolbarPlacement _toolbarPlacement;
- public Brush ToolbarBackground
+ public Brush ToolbarBackground
{
get { return (Brush)GetValue(ToolbarBackgroundProperty); }
set { SetValue(ToolbarBackgroundProperty, value); }
@@ -35,12 +40,24 @@ namespace Xamarin.Forms.Platform.WinRT
set { SetValue(ToolbarForegroundProperty, value); }
}
- public Visibility ToolbarVisibility
+ public Visibility TitleVisibility
{
- get { return (Visibility)GetValue(ToolbarVisibilityProperty); }
- set { SetValue(ToolbarVisibilityProperty, value); }
+ get { return (Visibility)GetValue(TitleVisibilityProperty); }
+ set { SetValue(TitleVisibilityProperty, value); }
}
+ public ToolbarPlacement ToolbarPlacement
+ {
+ get { return _toolbarPlacement; }
+ set
+ {
+ _toolbarPlacement = value;
+#if WINDOWS_UWP
+ UpdateToolbarPlacement();
+#endif
+ }
+ }
+
Task<CommandBar> IToolbarProvider.GetCommandBarAsync()
{
if (_commandBar != null)
@@ -54,12 +71,24 @@ namespace Xamarin.Forms.Platform.WinRT
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
+
_commandBar = GetTemplateChild("CommandBar") as CommandBar;
+
+#if WINDOWS_UWP
+ _bottomCommandBarArea = GetTemplateChild("BottomCommandBarArea") as Border;
+ _topCommandBarArea = GetTemplateChild("TopCommandBarArea") as Border;
+ UpdateToolbarPlacement();
+#endif
+
TaskCompletionSource<CommandBar> tcs = _commandBarTcs;
- if (tcs != null)
- {
- tcs.SetResult(_commandBar);
- }
+ tcs?.SetResult(_commandBar);
}
+
+#if WINDOWS_UWP
+ void UpdateToolbarPlacement()
+ {
+ ToolbarPlacementHelper.UpdateToolbarPlacement(_commandBar, ToolbarPlacement, _bottomCommandBarArea, _topCommandBarArea);
+ }
+#endif
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml b/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml
index b693a226..41ec603d 100644
--- a/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml
+++ b/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml
@@ -436,7 +436,8 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
- <Grid Height="79" Background="{TemplateBinding NavigationBarBackground}" Visibility="{Binding ShowNavigationBar,RelativeSource={RelativeSource Mode=TemplatedParent},Converter={StaticResource BoolVisibilityConverter}}">
+ <Grid Height="79" Background="{TemplateBinding NavigationBarBackground}"
+ Visibility="{TemplateBinding TitleVisibility}">
<TextBlock Margin="10,0,0,0" Name="title" Foreground="{TemplateBinding TitleBrush}" VerticalAlignment="Center" Style="{ThemeResource HeaderTextBlockStyle}" Text="{Binding Title}" />
</Grid>
<ContentPresenter x:Name="presenter" Grid.Row="1" ContentTransitions="{TemplateBinding ContentTransitions}" />
diff --git a/Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs
index df4fba71..b6731ce9 100644
--- a/Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs
@@ -187,7 +187,7 @@ namespace Xamarin.Forms.Platform.WinRT
return;
_showTitle = value;
- Control.ToolbarVisibility = _showTitle ? Visibility.Visible : Visibility.Collapsed;
+ Control.TitleVisibility = _showTitle ? Visibility.Visible : Visibility.Collapsed;
}
}