[UWP] Use toolbar foreground color on primary items (#640)

This commit is contained in:
Paul DiPietro 2016-12-19 06:45:15 -06:00 коммит произвёл Rui Marinho
Родитель e0165abbcd
Коммит df67dff982
3 изменённых файлов: 62 добавлений и 3 удалений

Просмотреть файл

@ -0,0 +1,55 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
// Apply the default category of "Issues" to all of the tests in this assembly
// We use this as a catch-all for tests which haven't been individually categorized
#if UITEST
[assembly: NUnit.Framework.Category("Issues")]
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 44453, "[UWP] ToolbarItem Text hard to see when BarTextColor is light", PlatformAffected.WinRT)]
public class Bugzilla44453 : TestMasterDetailPage
{
protected override void Init()
{
var content = new ContentPage
{
Title = "UWPToolbarItemColor",
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Children =
{
new Label
{
LineBreakMode = LineBreakMode.WordWrap,
HorizontalTextAlignment = TextAlignment.Center,
Text = "The toolbar secondary items should not have white text on a light background"
}
}
}
};
MasterBehavior = MasterBehavior.Popover;
Master = new ContentPage
{
Title = "Master"
};
Detail = new NavigationPage(content)
{
BarBackgroundColor = Color.Green,
BarTextColor = Color.White
};
Detail.ToolbarItems.Add(new ToolbarItem("Test Secondary Item", null, delegate { }, ToolbarItemOrder.Secondary));
}
}
}

Просмотреть файл

@ -134,6 +134,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43469.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43516.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43663.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44453.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44944.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44166.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44461.cs" />

Просмотреть файл

@ -296,13 +296,16 @@ namespace Xamarin.Forms.Platform.WinRT
button.Command = new MenuItemCommand(item);
button.DataContext = item;
ToolbarItemOrder order = item.Order == ToolbarItemOrder.Default ? ToolbarItemOrder.Primary : item.Order;
if (order == ToolbarItemOrder.Primary)
{
#if WINDOWS_UWP
toolBarProvider?.BindForegroundColor(button);
#endif
ToolbarItemOrder order = item.Order == ToolbarItemOrder.Default ? ToolbarItemOrder.Primary : item.Order;
if (order == ToolbarItemOrder.Primary)
commandBar.PrimaryCommands.Add(button);
}
else
commandBar.SecondaryCommands.Add(button);
}