* api changes for shell official * Update Xamarin.Forms.Core/Shell/Shell.cs Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Core/Shell/ShellItemCollection.cs Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Core/Shell/ShellSection.cs Co-Authored-By: PureWeen <shane94@hotmail.com> * Update Xamarin.Forms.Core/Shell/ShellItem.cs Co-Authored-By: PureWeen <shane94@hotmail.com> * fix compile errors * fix ui test * fix ui test * removed some more properties * remove a couple more
This commit is contained in:
Родитель
5210d5c1e6
Коммит
03e9a9fe43
|
@ -574,7 +574,7 @@ namespace Xamarin.Forms.Controls
|
|||
protected virtual bool Isolate => true;
|
||||
#endif
|
||||
|
||||
protected TestShell() : base(false)
|
||||
protected TestShell() : base()
|
||||
{
|
||||
#if APP
|
||||
Init();
|
||||
|
|
|
@ -6,27 +6,27 @@
|
|||
x:Class="Xamarin.Forms.Controls.XamStore.StoreShell">
|
||||
<Shell.Resources>
|
||||
<Style x:Key="BaseStyle" TargetType="Element">
|
||||
<Setter Property="Shell.ShellBackgroundColor" Value="#455A64" />
|
||||
<Setter Property="Shell.ShellForegroundColor" Value="White" />
|
||||
<Setter Property="Shell.ShellTitleColor" Value="White" />
|
||||
<Setter Property="Shell.ShellDisabledColor" Value="#B4FFFFFF" />
|
||||
<Setter Property="Shell.ShellUnselectedColor" Value="#95FFFFFF" />
|
||||
<Setter Property="Shell.BackgroundColor" Value="#455A64" />
|
||||
<Setter Property="Shell.ForegroundColor" Value="White" />
|
||||
<Setter Property="Shell.TitleColor" Value="White" />
|
||||
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
|
||||
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
|
||||
</Style>
|
||||
<Style TargetType="ShellItem" BasedOn="{StaticResource BaseStyle}" />
|
||||
<Style x:Key="GreenShell" TargetType="Element" BasedOn="{StaticResource BaseStyle}">
|
||||
<Setter Property="Shell.ShellBackgroundColor" Value="#689F39" />
|
||||
<Setter Property="Shell.BackgroundColor" Value="#689F39" />
|
||||
</Style>
|
||||
<Style x:Key="MusicShell" TargetType="Element" BasedOn="{StaticResource BaseStyle}">
|
||||
<Setter Property="Shell.ShellBackgroundColor" Value="#EF6C00" />
|
||||
<Setter Property="Shell.BackgroundColor" Value="#EF6C00" />
|
||||
</Style>
|
||||
<Style x:Key="MoviesShell" TargetType="Element" BasedOn="{StaticResource BaseStyle}">
|
||||
<Setter Property="Shell.ShellBackgroundColor" Value="#ED3B3B" />
|
||||
<Setter Property="Shell.BackgroundColor" Value="#ED3B3B" />
|
||||
</Style>
|
||||
<Style x:Key="BooksShell" TargetType="Element" BasedOn="{StaticResource BaseStyle}">
|
||||
<Setter Property="Shell.ShellBackgroundColor" Value="#039BE6" />
|
||||
<Setter Property="Shell.BackgroundColor" Value="#039BE6" />
|
||||
</Style>
|
||||
<Style x:Key="NewsShell" TargetType="Element" BasedOn="{StaticResource BaseStyle}">
|
||||
<Setter Property="Shell.ShellBackgroundColor" Value="#546DFE" />
|
||||
<Setter Property="Shell.BackgroundColor" Value="#546DFE" />
|
||||
</Style>
|
||||
</Shell.Resources>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?xaml-comp compile="true" ?>
|
||||
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:converters="clr-namespace:ConferenceVision.Converters"
|
||||
|
@ -60,11 +60,11 @@
|
|||
|
||||
<!-- Shell Styles -->
|
||||
<Style x:Key="BaseStyle" TargetType="Element">
|
||||
<Setter Property="Shell.ShellBackgroundColor" Value="#11313F" />
|
||||
<Setter Property="Shell.BackgroundColor" Value="#11313F" />
|
||||
<Setter Property="Shell.FlyoutBackgroundColor" Value="#11313F" />
|
||||
<Setter Property="Shell.ShellForegroundColor" Value="White" />
|
||||
<Setter Property="Shell.ShellTitleColor" Value="White" />
|
||||
<Setter Property="Shell.ShellDisabledColor" Value="#B4FFFFFF" />
|
||||
<Setter Property="Shell.ShellUnselectedColor" Value="#95FFFFFF" />
|
||||
<Setter Property="Shell.ForegroundColor" Value="White" />
|
||||
<Setter Property="Shell.TitleColor" Value="White" />
|
||||
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
|
||||
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
|
@ -20,7 +20,7 @@ namespace Xamarin.Forms.Controls.XamStore
|
|||
public BasePage(string title, Color tint)
|
||||
{
|
||||
Title = title;
|
||||
Shell.SetShellForegroundColor(this, tint);
|
||||
Shell.SetForegroundColor(this, tint);
|
||||
var grid = new Grid()
|
||||
{
|
||||
Padding = 20,
|
||||
|
@ -223,7 +223,7 @@ namespace Xamarin.Forms.Controls.XamStore
|
|||
grid.Children.Add(MakeButton("Go Back with Text",
|
||||
async () => {
|
||||
var page = (Page)Activator.CreateInstance(GetType());
|
||||
Shell.SetShellForegroundColor(page, Color.Pink);
|
||||
Shell.SetForegroundColor(page, Color.Pink);
|
||||
Shell.SetBackButtonBehavior(page, new BackButtonBehavior()
|
||||
{
|
||||
//IconOverride = "calculator.png",
|
||||
|
|
|
@ -532,8 +532,6 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
[SetUp]
|
||||
public override void Setup()
|
||||
{
|
||||
Device.SetFlags(new List<string> { ExperimentalFlags.ShellExperimental });
|
||||
|
||||
base.Setup();
|
||||
Device.PlatformServices = new MockPlatformServices();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
[SetUp]
|
||||
public override void Setup()
|
||||
{
|
||||
Device.SetFlags(new[] { Shell.ShellExperimental });
|
||||
base.Setup();
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
NavigationProxy proxy = page.NavigationProxy.Inner as NavigationProxy;
|
||||
Assert.IsNotNull(proxy);
|
||||
|
||||
NavigationProxy shellProxy = proxy.Inner as ShellSection.NavigationImpl;
|
||||
var shellProxy = proxy.Inner;
|
||||
Assert.IsNotNull(shellProxy);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
[SetUp]
|
||||
public override void Setup()
|
||||
{
|
||||
Device.SetFlags(new List<string> { ExperimentalFlags.ShellExperimental });
|
||||
base.Setup();
|
||||
var mockDeviceInfo = new TestDeviceInfo();
|
||||
Device.Info = mockDeviceInfo;
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace Xamarin.Forms
|
|||
internal static class ExperimentalFlags
|
||||
{
|
||||
internal const string CollectionViewExperimental = "CollectionView_Experimental";
|
||||
internal const string ShellExperimental = "Shell_Experimental";
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static void VerifyFlagEnabled(
|
||||
|
|
|
@ -115,13 +115,13 @@ using Xamarin.Forms.StyleSheets;
|
|||
|
||||
//shell
|
||||
[assembly: StyleProperty("-xf-flyout-background", typeof(Shell), nameof(Shell.FlyoutBackgroundColorProperty))]
|
||||
[assembly: StyleProperty("-xf-shell-background", typeof(Element), nameof(Shell.ShellBackgroundColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-disabled", typeof(Element), nameof(Shell.ShellDisabledColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-foreground", typeof(Element), nameof(Shell.ShellForegroundColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-background", typeof(Element), nameof(Shell.ShellTabBarBackgroundColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-disabled", typeof(Element), nameof(Shell.ShellTabBarDisabledColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-foreground", typeof(Element), nameof(Shell.ShellTabBarForegroundColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-title", typeof(Element), nameof(Shell.ShellTabBarTitleColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-unselected", typeof(Element), nameof(Shell.ShellTabBarUnselectedColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-title", typeof(Element), nameof(Shell.ShellTitleColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-unselected", typeof(Element), nameof(Shell.ShellUnselectedColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-background", typeof(Element), nameof(Shell.BackgroundColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-disabled", typeof(Element), nameof(Shell.DisabledColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-foreground", typeof(Element), nameof(Shell.ForegroundColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-background", typeof(Element), nameof(Shell.TabBarBackgroundColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-disabled", typeof(Element), nameof(Shell.TabBarDisabledColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-foreground", typeof(Element), nameof(Shell.TabBarForegroundColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-title", typeof(Element), nameof(Shell.TabBarTitleColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-tabbar-unselected", typeof(Element), nameof(Shell.TabBarUnselectedColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-title", typeof(Element), nameof(Shell.TitleColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
[assembly: StyleProperty("-xf-shell-unselected", typeof(Element), nameof(Shell.UnselectedColorProperty), PropertyOwnerType = typeof(Shell))]
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
|
@ -83,77 +78,77 @@ namespace Xamarin.Forms
|
|||
}
|
||||
}
|
||||
|
||||
public static readonly BindableProperty ShellBackgroundColorProperty =
|
||||
BindableProperty.CreateAttached("ShellBackgroundColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly new BindableProperty BackgroundColorProperty =
|
||||
BindableProperty.CreateAttached("BackgroundColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static readonly BindableProperty ShellDisabledColorProperty =
|
||||
BindableProperty.CreateAttached("ShellDisabledColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly BindableProperty DisabledColorProperty =
|
||||
BindableProperty.CreateAttached("DisabledColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static readonly BindableProperty ShellForegroundColorProperty =
|
||||
BindableProperty.CreateAttached("ShellForegroundColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly BindableProperty ForegroundColorProperty =
|
||||
BindableProperty.CreateAttached("ForegroundColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static readonly BindableProperty ShellTabBarBackgroundColorProperty =
|
||||
BindableProperty.CreateAttached("ShellTabBarBackgroundColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly BindableProperty TabBarBackgroundColorProperty =
|
||||
BindableProperty.CreateAttached("TabBarBackgroundColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static readonly BindableProperty ShellTabBarDisabledColorProperty =
|
||||
BindableProperty.CreateAttached("ShellTabBarDisabledColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly BindableProperty TabBarDisabledColorProperty =
|
||||
BindableProperty.CreateAttached("TabBarDisabledColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static readonly BindableProperty ShellTabBarForegroundColorProperty =
|
||||
BindableProperty.CreateAttached("ShellTabBarForegroundColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly BindableProperty TabBarForegroundColorProperty =
|
||||
BindableProperty.CreateAttached("TabBarForegroundColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static readonly BindableProperty ShellTabBarTitleColorProperty =
|
||||
BindableProperty.CreateAttached("ShellTabBarTitleColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly BindableProperty TabBarTitleColorProperty =
|
||||
BindableProperty.CreateAttached("TabBarTitleColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static readonly BindableProperty ShellTabBarUnselectedColorProperty =
|
||||
BindableProperty.CreateAttached("ShellTabBarUnselectedColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly BindableProperty TabBarUnselectedColorProperty =
|
||||
BindableProperty.CreateAttached("TabBarUnselectedColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static readonly BindableProperty ShellTitleColorProperty =
|
||||
BindableProperty.CreateAttached("ShellTitleColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly BindableProperty TitleColorProperty =
|
||||
BindableProperty.CreateAttached("TitleColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static readonly BindableProperty ShellUnselectedColorProperty =
|
||||
BindableProperty.CreateAttached("ShellUnselectedColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnShellColorValueChanged);
|
||||
public static readonly BindableProperty UnselectedColorProperty =
|
||||
BindableProperty.CreateAttached("UnselectedColor", typeof(Color), typeof(Shell), Color.Default,
|
||||
propertyChanged: OnColorValueChanged);
|
||||
|
||||
public static Color GetShellBackgroundColor(BindableObject obj) => (Color)obj.GetValue(ShellBackgroundColorProperty);
|
||||
public static void SetShellBackgroundColor(BindableObject obj, Color value) => obj.SetValue(ShellBackgroundColorProperty, value);
|
||||
public static Color GetBackgroundColor(BindableObject obj) => (Color)obj.GetValue(BackgroundColorProperty);
|
||||
public static void SetBackgroundColor(BindableObject obj, Color value) => obj.SetValue(BackgroundColorProperty, value);
|
||||
|
||||
public static Color GetShellDisabledColor(BindableObject obj) => (Color)obj.GetValue(ShellDisabledColorProperty);
|
||||
public static void SetShellDisabledColor(BindableObject obj, Color value) => obj.SetValue(ShellDisabledColorProperty, value);
|
||||
public static Color GetDisabledColor(BindableObject obj) => (Color)obj.GetValue(DisabledColorProperty);
|
||||
public static void SetDisabledColor(BindableObject obj, Color value) => obj.SetValue(DisabledColorProperty, value);
|
||||
|
||||
public static Color GetShellForegroundColor(BindableObject obj) => (Color)obj.GetValue(ShellForegroundColorProperty);
|
||||
public static void SetShellForegroundColor(BindableObject obj, Color value) => obj.SetValue(ShellForegroundColorProperty, value);
|
||||
public static Color GetForegroundColor(BindableObject obj) => (Color)obj.GetValue(ForegroundColorProperty);
|
||||
public static void SetForegroundColor(BindableObject obj, Color value) => obj.SetValue(ForegroundColorProperty, value);
|
||||
|
||||
public static Color GetShellTabBarBackgroundColor(BindableObject obj) => (Color)obj.GetValue(ShellTabBarBackgroundColorProperty);
|
||||
public static void SetShellTabBarBackgroundColor(BindableObject obj, Color value) => obj.SetValue(ShellTabBarBackgroundColorProperty, value);
|
||||
public static Color GetTabBarBackgroundColor(BindableObject obj) => (Color)obj.GetValue(TabBarBackgroundColorProperty);
|
||||
public static void SetTabBarBackgroundColor(BindableObject obj, Color value) => obj.SetValue(TabBarBackgroundColorProperty, value);
|
||||
|
||||
public static Color GetShellTabBarDisabledColor(BindableObject obj) => (Color)obj.GetValue(ShellTabBarDisabledColorProperty);
|
||||
public static void SetShellTabBarDisabledColor(BindableObject obj, Color value) => obj.SetValue(ShellTabBarDisabledColorProperty, value);
|
||||
public static Color GetTabBarDisabledColor(BindableObject obj) => (Color)obj.GetValue(TabBarDisabledColorProperty);
|
||||
public static void SetTabBarDisabledColor(BindableObject obj, Color value) => obj.SetValue(TabBarDisabledColorProperty, value);
|
||||
|
||||
public static Color GetShellTabBarForegroundColor(BindableObject obj) => (Color)obj.GetValue(ShellTabBarForegroundColorProperty);
|
||||
public static void SetShellTabBarForegroundColor(BindableObject obj, Color value) => obj.SetValue(ShellTabBarForegroundColorProperty, value);
|
||||
public static Color GetTabBarForegroundColor(BindableObject obj) => (Color)obj.GetValue(TabBarForegroundColorProperty);
|
||||
public static void SetTabBarForegroundColor(BindableObject obj, Color value) => obj.SetValue(TabBarForegroundColorProperty, value);
|
||||
|
||||
public static Color GetShellTabBarTitleColor(BindableObject obj) => (Color)obj.GetValue(ShellTabBarTitleColorProperty);
|
||||
public static void SetShellTabBarTitleColor(BindableObject obj, Color value) => obj.SetValue(ShellTabBarTitleColorProperty, value);
|
||||
public static Color GetTabBarTitleColor(BindableObject obj) => (Color)obj.GetValue(TabBarTitleColorProperty);
|
||||
public static void SetTabBarTitleColor(BindableObject obj, Color value) => obj.SetValue(TabBarTitleColorProperty, value);
|
||||
|
||||
public static Color GetShellTabBarUnselectedColor(BindableObject obj) => (Color)obj.GetValue(ShellTabBarUnselectedColorProperty);
|
||||
public static void SetShellTabBarUnselectedColor(BindableObject obj, Color value) => obj.SetValue(ShellTabBarUnselectedColorProperty, value);
|
||||
public static Color GetTabBarUnselectedColor(BindableObject obj) => (Color)obj.GetValue(TabBarUnselectedColorProperty);
|
||||
public static void SetTabBarUnselectedColor(BindableObject obj, Color value) => obj.SetValue(TabBarUnselectedColorProperty, value);
|
||||
|
||||
public static Color GetShellTitleColor(BindableObject obj) => (Color)obj.GetValue(ShellTitleColorProperty);
|
||||
public static void SetShellTitleColor(BindableObject obj, Color value) => obj.SetValue(ShellTitleColorProperty, value);
|
||||
public static Color GetTitleColor(BindableObject obj) => (Color)obj.GetValue(TitleColorProperty);
|
||||
public static void SetTitleColor(BindableObject obj, Color value) => obj.SetValue(TitleColorProperty, value);
|
||||
|
||||
public static Color GetShellUnselectedColor(BindableObject obj) => (Color)obj.GetValue(ShellUnselectedColorProperty);
|
||||
public static void SetShellUnselectedColor(BindableObject obj, Color value) => obj.SetValue(ShellUnselectedColorProperty, value);
|
||||
public static Color GetUnselectedColor(BindableObject obj) => (Color)obj.GetValue(UnselectedColorProperty);
|
||||
public static void SetUnselectedColor(BindableObject obj, Color value) => obj.SetValue(UnselectedColorProperty, value);
|
||||
|
||||
static void OnShellColorValueChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
static void OnColorValueChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
var item = (Element)bindable;
|
||||
var source = item;
|
||||
|
@ -194,7 +189,7 @@ namespace Xamarin.Forms
|
|||
void IShellController.AddAppearanceObserver(IAppearanceObserver observer, Element pivot)
|
||||
{
|
||||
_appearanceObservers.Add((observer, pivot));
|
||||
observer.OnAppearanceChanged(GetShellAppearanceForPivot(pivot));
|
||||
observer.OnAppearanceChanged(GetAppearanceForPivot(pivot));
|
||||
}
|
||||
|
||||
void IShellController.AddFlyoutBehaviorObserver(IFlyoutBehaviorObserver observer)
|
||||
|
@ -242,7 +237,7 @@ namespace Xamarin.Forms
|
|||
{
|
||||
if (leaf == target)
|
||||
{
|
||||
observer.OnAppearanceChanged(GetShellAppearanceForPivot(pivot));
|
||||
observer.OnAppearanceChanged(GetAppearanceForPivot(pivot));
|
||||
break;
|
||||
}
|
||||
leaf = leaf.Parent;
|
||||
|
@ -571,30 +566,14 @@ namespace Xamarin.Forms
|
|||
ShellNavigatedEventArgs _accumulatedEvent;
|
||||
bool _accumulateNavigatedEvents;
|
||||
View _flyoutHeaderView;
|
||||
bool _checkExperimentalFlag = true;
|
||||
|
||||
public Shell() : this(true)
|
||||
{
|
||||
}
|
||||
|
||||
internal Shell(bool checkFlag)
|
||||
public Shell()
|
||||
{
|
||||
Navigation = new NavigationImpl(this);
|
||||
_checkExperimentalFlag = checkFlag;
|
||||
VerifyShellFlagEnabled(constructorHint: nameof(Shell));
|
||||
((INotifyCollectionChanged)Items).CollectionChanged += (s, e) => SendStructureChanged();
|
||||
Route = Routing.GenerateImplicitRoute("shell");
|
||||
}
|
||||
|
||||
internal const string ShellExperimental = ExperimentalFlags.ShellExperimental;
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
internal void VerifyShellFlagEnabled(string constructorHint = null, [CallerMemberName] string memberName = "")
|
||||
{
|
||||
if (_checkExperimentalFlag)
|
||||
ExperimentalFlags.VerifyFlagEnabled("Shell", ShellExperimental, constructorHint, memberName);
|
||||
}
|
||||
|
||||
public event EventHandler<ShellNavigatedEventArgs> Navigated;
|
||||
public event EventHandler<ShellNavigatingEventArgs> Navigating;
|
||||
|
||||
|
@ -649,8 +628,7 @@ namespace Xamarin.Forms
|
|||
set => SetValue(FlyoutIsPresentedProperty, value);
|
||||
}
|
||||
|
||||
public ShellItemCollection Items => (ShellItemCollection)GetValue(ItemsProperty);
|
||||
public ShellItemCollection Flyout => Items;
|
||||
public IList<ShellItem> Items => (IList<ShellItem>)GetValue(ItemsProperty);
|
||||
|
||||
public DataTemplate ItemTemplate
|
||||
{
|
||||
|
@ -969,7 +947,7 @@ namespace Xamarin.Forms
|
|||
return FlyoutBehavior;
|
||||
}
|
||||
|
||||
ShellAppearance GetShellAppearanceForPivot(Element pivot)
|
||||
ShellAppearance GetAppearanceForPivot(Element pivot)
|
||||
{
|
||||
// this algorithm is pretty simple
|
||||
// 1) Get the "CurrentPage" by walking down from the pivot
|
||||
|
@ -1090,7 +1068,7 @@ namespace Xamarin.Forms
|
|||
PropertyPropagationExtensions.PropagatePropertyChanged(propertyName, this, new[] { FlyoutHeaderView });
|
||||
}
|
||||
|
||||
public class NavigationImpl : NavigationProxy
|
||||
class NavigationImpl : NavigationProxy
|
||||
{
|
||||
readonly Shell _shell;
|
||||
|
||||
|
|
|
@ -8,16 +8,16 @@ namespace Xamarin.Forms
|
|||
{
|
||||
static readonly BindableProperty[] s_ingestArray = new[]
|
||||
{
|
||||
Shell.ShellBackgroundColorProperty,
|
||||
Shell.ShellDisabledColorProperty,
|
||||
Shell.ShellForegroundColorProperty,
|
||||
Shell.ShellTabBarBackgroundColorProperty,
|
||||
Shell.ShellTabBarDisabledColorProperty,
|
||||
Shell.ShellTabBarForegroundColorProperty,
|
||||
Shell.ShellTabBarTitleColorProperty,
|
||||
Shell.ShellTabBarUnselectedColorProperty,
|
||||
Shell.ShellTitleColorProperty,
|
||||
Shell.ShellUnselectedColorProperty
|
||||
Shell.BackgroundColorProperty,
|
||||
Shell.DisabledColorProperty,
|
||||
Shell.ForegroundColorProperty,
|
||||
Shell.TabBarBackgroundColorProperty,
|
||||
Shell.TabBarDisabledColorProperty,
|
||||
Shell.TabBarForegroundColorProperty,
|
||||
Shell.TabBarTitleColorProperty,
|
||||
Shell.TabBarUnselectedColorProperty,
|
||||
Shell.TitleColorProperty,
|
||||
Shell.UnselectedColorProperty
|
||||
};
|
||||
|
||||
Color?[] _colorArray = new Color?[s_ingestArray.Length];
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Collections.Specialized;
|
|||
|
||||
namespace Xamarin.Forms
|
||||
{
|
||||
public sealed class ShellContentCollection : IList<ShellContent>, INotifyCollectionChanged
|
||||
internal sealed class ShellContentCollection : IList<ShellContent>, INotifyCollectionChanged
|
||||
{
|
||||
ObservableCollection<ShellContent> _inner = new ObservableCollection<ShellContent>();
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ namespace Xamarin.Forms
|
|||
{
|
||||
Shell.SetFlyoutBehavior(this, FlyoutBehavior.Flyout);
|
||||
}
|
||||
|
||||
public ShellSectionCollection Tabs => Items;
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
|
@ -26,8 +24,6 @@ namespace Xamarin.Forms
|
|||
{
|
||||
Shell.SetFlyoutBehavior(this, FlyoutBehavior.Disabled);
|
||||
}
|
||||
|
||||
public ShellSectionCollection Tabs => Items;
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +108,7 @@ namespace Xamarin.Forms
|
|||
set { SetValue(CurrentItemProperty, value); }
|
||||
}
|
||||
|
||||
public ShellSectionCollection Items => (ShellSectionCollection)GetValue(ItemsProperty);
|
||||
public IList<ShellSection> Items => (IList<ShellSection>)GetValue(ItemsProperty);
|
||||
|
||||
internal override ReadOnlyCollection<Element> LogicalChildrenInternal => _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(_children));
|
||||
|
||||
|
@ -233,4 +229,4 @@ namespace Xamarin.Forms
|
|||
SendStructureChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Collections.Specialized;
|
|||
|
||||
namespace Xamarin.Forms
|
||||
{
|
||||
public sealed class ShellItemCollection : IEnumerable<ShellItem>, IList<ShellItem>, INotifyCollectionChanged
|
||||
internal sealed class ShellItemCollection : IList<ShellItem>, INotifyCollectionChanged
|
||||
{
|
||||
event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
@ -13,7 +12,6 @@ namespace Xamarin.Forms
|
|||
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||
public class Tab : ShellSection
|
||||
{
|
||||
public ShellContentCollection Content => Items;
|
||||
}
|
||||
|
||||
[ContentProperty(nameof(Items))]
|
||||
|
@ -166,7 +164,7 @@ namespace Xamarin.Forms
|
|||
set { SetValue(CurrentItemProperty, value); }
|
||||
}
|
||||
|
||||
public ShellContentCollection Items => (ShellContentCollection)GetValue(ItemsProperty);
|
||||
public IList<ShellContent> Items => (IList<ShellContent>)GetValue(ItemsProperty);
|
||||
|
||||
public IReadOnlyList<Page> Stack => _navStack;
|
||||
|
||||
|
@ -556,7 +554,7 @@ namespace Xamarin.Forms
|
|||
}
|
||||
}
|
||||
|
||||
public class NavigationImpl : NavigationProxy
|
||||
class NavigationImpl : NavigationProxy
|
||||
{
|
||||
readonly ShellSection _owner;
|
||||
|
||||
|
@ -575,4 +573,4 @@ namespace Xamarin.Forms
|
|||
protected override void OnRemovePage(Page page) => _owner.OnRemovePage(page);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Collections.Specialized;
|
|||
|
||||
namespace Xamarin.Forms
|
||||
{
|
||||
public sealed class ShellSectionCollection : IList<ShellSection>, INotifyCollectionChanged
|
||||
internal sealed class ShellSectionCollection : IList<ShellSection>, INotifyCollectionChanged
|
||||
{
|
||||
event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged
|
||||
{
|
||||
|
|
|
@ -16,21 +16,17 @@ namespace Xamarin.Forms.Xaml.UnitTests
|
|||
|
||||
[TestFixture] class Tests
|
||||
{
|
||||
IReadOnlyList<string> _flags;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Device.PlatformServices = new MockPlatformServices();
|
||||
_flags = Device.Flags;
|
||||
Device.SetFlags(new List<string>() { ExperimentalFlags.ShellExperimental});
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Device.PlatformServices = null;
|
||||
Device.SetFlags(_flags);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -28,21 +28,16 @@ namespace Xamarin.Forms.Xaml.UnitTests
|
|||
|
||||
[TestFixture] class Tests
|
||||
{
|
||||
IReadOnlyList<string> _flags;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Device.PlatformServices = new MockPlatformServices();
|
||||
_flags = Device.Flags;
|
||||
Device.SetFlags(new List<string>() { ExperimentalFlags.ShellExperimental });
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Device.PlatformServices = null;
|
||||
Device.SetFlags(_flags);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
Загрузка…
Ссылка в новой задаче