зеркало из https://github.com/DeGsoft/maui-linux.git
[UWP] Use toolbar foreground color on primary items (#640)
This commit is contained in:
Родитель
e0165abbcd
Коммит
df67dff982
|
@ -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)Bugzilla43469.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43516.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43516.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43663.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43663.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44453.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44944.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44944.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44166.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44166.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44461.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44461.cs" />
|
||||||
|
|
|
@ -296,13 +296,16 @@ namespace Xamarin.Forms.Platform.WinRT
|
||||||
button.Command = new MenuItemCommand(item);
|
button.Command = new MenuItemCommand(item);
|
||||||
button.DataContext = item;
|
button.DataContext = item;
|
||||||
|
|
||||||
|
|
||||||
|
ToolbarItemOrder order = item.Order == ToolbarItemOrder.Default ? ToolbarItemOrder.Primary : item.Order;
|
||||||
|
|
||||||
|
if (order == ToolbarItemOrder.Primary)
|
||||||
|
{
|
||||||
#if WINDOWS_UWP
|
#if WINDOWS_UWP
|
||||||
toolBarProvider?.BindForegroundColor(button);
|
toolBarProvider?.BindForegroundColor(button);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ToolbarItemOrder order = item.Order == ToolbarItemOrder.Default ? ToolbarItemOrder.Primary : item.Order;
|
|
||||||
if (order == ToolbarItemOrder.Primary)
|
|
||||||
commandBar.PrimaryCommands.Add(button);
|
commandBar.PrimaryCommands.Add(button);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
commandBar.SecondaryCommands.Add(button);
|
commandBar.SecondaryCommands.Add(button);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче