Generate conditional XAML
This commit is contained in:
Родитель
fd94abb90c
Коммит
a100bb60b7
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27703.2000
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29324.140
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentEditor", "FluentEditor\FluentEditor.csproj", "{8A6123DE-52D5-41D0-B08D-7A045CADA16E}"
|
||||
EndProject
|
||||
|
@ -20,6 +20,8 @@ Global
|
|||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8A6123DE-52D5-41D0-B08D-7A045CADA16E}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{8A6123DE-52D5-41D0-B08D-7A045CADA16E}.Debug|Any CPU.Build.0 = Debug|x86
|
||||
{8A6123DE-52D5-41D0-B08D-7A045CADA16E}.Debug|Any CPU.Deploy.0 = Debug|x86
|
||||
{8A6123DE-52D5-41D0-B08D-7A045CADA16E}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{8A6123DE-52D5-41D0-B08D-7A045CADA16E}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{8A6123DE-52D5-41D0-B08D-7A045CADA16E}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
|
|
|
@ -31,11 +31,17 @@ namespace FluentEditor.ControlPalette.Model
|
|||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("<!-- Free Public License 1.0.0 Permission to use, copy, modify, and/or distribute this code for any purpose with or without fee is hereby granted. -->");
|
||||
|
||||
sb.AppendLine("<ResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"");
|
||||
sb.AppendLine(" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"");
|
||||
sb.AppendLine(" xmlns:Windows10version1809=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)\"");
|
||||
sb.AppendLine(" xmlns:BelowWindows10version1809=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract, 7)\">");
|
||||
|
||||
sb.AppendLine(" <ResourceDictionary.ThemeDictionaries>");
|
||||
|
||||
sb.AppendLine(" <ResourceDictionary x:Key=\"Default\">");
|
||||
sb.AppendLine(" <ResourceDictionary.MergedDictionaries>");
|
||||
sb.Append(" <ColorPaletteResources");
|
||||
sb.Append(" <Windows10version1809:ColorPaletteResources");
|
||||
if (model.DarkColorMapping != null)
|
||||
{
|
||||
foreach (var m in model.DarkColorMapping)
|
||||
|
@ -50,6 +56,14 @@ namespace FluentEditor.ControlPalette.Model
|
|||
sb.AppendLine(" />");
|
||||
sb.AppendLine(" <ResourceDictionary>");
|
||||
|
||||
if (model.DarkColorMapping != null)
|
||||
{
|
||||
foreach (var m in model.DarkColorMapping)
|
||||
{
|
||||
sb.AppendLine($" <BelowWindows10version1809:Color x:Key=\"System{m.Target.ToString()}Color\">{m.Source.ActiveColor.ToString()}</BelowWindows10version1809:Color>");
|
||||
}
|
||||
}
|
||||
|
||||
Windows.UI.Color ChromeAltMediumHigh = model.DarkRegion.ActiveColor;
|
||||
ChromeAltMediumHigh.A = 204;
|
||||
|
||||
|
@ -125,7 +139,7 @@ namespace FluentEditor.ControlPalette.Model
|
|||
|
||||
sb.AppendLine(" <ResourceDictionary x:Key=\"Light\">");
|
||||
sb.AppendLine(" <ResourceDictionary.MergedDictionaries>");
|
||||
sb.Append(" <ColorPaletteResources");
|
||||
sb.Append(" <Windows10version1809:ColorPaletteResources");
|
||||
if (model.LightColorMapping != null)
|
||||
{
|
||||
foreach (var m in model.LightColorMapping)
|
||||
|
@ -140,6 +154,14 @@ namespace FluentEditor.ControlPalette.Model
|
|||
sb.AppendLine(" />");
|
||||
sb.AppendLine(" <ResourceDictionary>");
|
||||
|
||||
if (model.DarkColorMapping != null)
|
||||
{
|
||||
foreach (var m in model.LightColorMapping)
|
||||
{
|
||||
sb.AppendLine($" <BelowWindows10version1809:Color x:Key=\"System{m.Target.ToString()}Color\">{m.Source.ActiveColor.ToString()}</BelowWindows10version1809:Color>");
|
||||
}
|
||||
}
|
||||
|
||||
ChromeAltMediumHigh = model.LightRegion.ActiveColor;
|
||||
ChromeAltMediumHigh.A = 204;
|
||||
|
||||
|
@ -221,6 +243,7 @@ namespace FluentEditor.ControlPalette.Model
|
|||
sb.AppendLine(" </ResourceDictionary>");
|
||||
|
||||
sb.AppendLine(" </ResourceDictionary.ThemeDictionaries>");
|
||||
sb.AppendLine("</ResourceDictionary>");
|
||||
|
||||
var retVal = sb.ToString();
|
||||
return retVal;
|
||||
|
|
Загрузка…
Ссылка в новой задаче