public static void ApplyColorProperty(ApplicationColorSet applicationColorSet, Color Color, ThemeColorProperty Property) { if (applicationColorSet == null) return; switch (Property) { case ThemeColorProperty.BackgroundEndGradientColor: applicationColorSet.BackgroundEndGradientColor = Color; break; case ThemeColorProperty.BackgroundStartGradientColor: applicationColorSet.BackgroundStartGradientColor = Color; break; case ThemeColorProperty.AccentColor: applicationColorSet.AccentColor = Color; break; case ThemeColorProperty.AccentTextColor: applicationColorSet.AccentTextColor = Color; break; case ThemeColorProperty.BackgroundTextColor: applicationColorSet.BackgroundTextColor = Color; break; case ThemeColorProperty.SelectionColor: applicationColorSet.SelectionColor = Color; break; case ThemeColorProperty.SelectionOutlineColor: applicationColorSet.SelectionOutlineColor = Color; break; } }
private static ApplicationColorSet fromResourceDictionary(ResourceDictionary dict) { if (dict == null) return null; ApplicationColorSet colors = new ApplicationColorSet(); colors.AccentColor = (Color)dict[ACCENT_COLOR]; colors.AccentTextColor = (Color)dict[ACCENT_TEXT_COLOR]; colors.BackgroundEndGradientColor = (Color)dict[BACKGROUND_END_GRADIENT_STOP_COLOR]; colors.BackgroundStartGradientColor = (Color)dict[BACKGROUND_START_GRADIENT_STOP_COLOR]; colors.BackgroundTextColor = (Color)dict[BACKGROUND_TEXT_COLOR]; colors.SelectionColor = (Color)dict[SELECTION_COLOR]; colors.SelectionOutlineColor = (Color)dict[SELECTION_OUTLINE_COLOR]; return colors; }