[UWP] Fixes IndexOutOfRangeException on TabbedPage (#6385)
* [UWP] Fixes IndexOutOfRangeException on TabbedPage * add tab page category * fix update colors * optimization
This commit is contained in:
Родитель
15b01e5b68
Коммит
ca8bd3fa71
|
@ -0,0 +1,37 @@
|
|||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
using System;
|
||||
|
||||
#if UITEST
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 6323, "TabbedPage Page not watching icon changes", PlatformAffected.UWP)]
|
||||
public class Issue6323 : TestTabbedPage
|
||||
{
|
||||
protected override void Init()
|
||||
{
|
||||
SelectedTabColor = Color.Purple;
|
||||
Device.StartTimer(TimeSpan.FromSeconds(2), () =>
|
||||
{
|
||||
Children.Add(new ContentPage
|
||||
{
|
||||
Content = new Label { Text = "Success" },
|
||||
Title = "I'm a title"
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
#if UITEST && __WINDOWS__
|
||||
[Test]
|
||||
public void Issue6323Test()
|
||||
{
|
||||
RunningApp.WaitForElement("Success");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -518,6 +518,9 @@ namespace Xamarin.Forms.Controls
|
|||
protected abstract void Init();
|
||||
}
|
||||
|
||||
#if UITEST
|
||||
[Category(UITestCategories.TabbedPage)]
|
||||
#endif
|
||||
public abstract class TestTabbedPage : TabbedPage
|
||||
{
|
||||
#if UITEST
|
||||
|
|
|
@ -861,6 +861,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla41038.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla38284.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla39486.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue6323.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue55555.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla41029.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla39908.cs" />
|
||||
|
|
|
@ -48,5 +48,6 @@
|
|||
public const string Visual = "Visual";
|
||||
public const string AppLinks = "AppLinks";
|
||||
public const string Shell = "Shell";
|
||||
public const string TabbedPage = "TabbedPage";
|
||||
}
|
||||
}
|
|
@ -287,6 +287,7 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
// Need to make sure any new items have the correct fore/background colors
|
||||
ApplyBarBackgroundColor(true);
|
||||
ApplyBarTextColor(true);
|
||||
UpdateSelectedTabColors();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -555,6 +556,8 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
{
|
||||
// Retrieve all tab header textblocks
|
||||
var allTabHeaderTextBlocks = Control.GetDescendantsByName<WTextBlock>(TabBarHeaderTextBlockName).ToArray();
|
||||
if (allTabHeaderTextBlocks.Length != Control.Items.Count)
|
||||
return;
|
||||
|
||||
// Loop through all pages in the Pivot control
|
||||
foreach (Page page in Control.Items)
|
||||
|
|
Загрузка…
Ссылка в новой задаче