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;
            }
        }
        void AssociatedObject_ColorPicked(object sender, ColorChosenEventArgs e)
        {
            if (string.IsNullOrEmpty(PropertyName))
            {
                return;
            }
            ThemeColorProperty property = (ThemeColorProperty)Enum.Parse(typeof(ThemeColorProperty), PropertyName, true);

            ThemeColorHelper.ApplyColorProperty(ApplicationColorSet, e.Color, property);
        }
        private void ColorOptionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBoxItem selectedItem = ColorOptionComboBox.SelectedItem as ListBoxItem;

            if (selectedItem == null)
            {
                return;
            }
            string colorOption = selectedItem.Tag as string;

            if (string.IsNullOrEmpty(colorOption))
            {
                return;
            }

            if (colorOption == "BackgroundColor")
            {
                ColorPaletteContainer.Visibility      = System.Windows.Visibility.Collapsed;
                BackgroundColorPicker.BackgroundStart = new SolidColorBrush(View.Instance.ApplicationColorSet.BackgroundStartGradientColor);
                BackgroundColorPicker.BackgroundEnd   = new SolidColorBrush(View.Instance.ApplicationColorSet.BackgroundEndGradientColor);
                BackgroundColorPicker.Visibility      = System.Windows.Visibility.Visible;
            }
            else
            {
                BackgroundColorPicker.Visibility = System.Windows.Visibility.Collapsed;
                ThemeColorProperty property = (ThemeColorProperty)Enum.Parse(typeof(ThemeColorProperty), colorOption, true);
                switch (property)
                {
                case ThemeColorProperty.AccentColor:
                    ColorPalette.SelectedColorBrush = new SolidColorBrush(View.Instance.ApplicationColorSet.AccentColor);
                    break;

                case ThemeColorProperty.AccentTextColor:
                    ColorPalette.SelectedColorBrush = new SolidColorBrush(View.Instance.ApplicationColorSet.AccentTextColor);
                    break;

                case ThemeColorProperty.BackgroundTextColor:
                    ColorPalette.SelectedColorBrush = new SolidColorBrush(View.Instance.ApplicationColorSet.BackgroundTextColor);
                    break;

                case ThemeColorProperty.SelectionColor:
                    ColorPalette.SelectedColorBrush = new SolidColorBrush(View.Instance.ApplicationColorSet.SelectionColor);
                    break;

                case ThemeColorProperty.SelectionOutlineColor:
                    ColorPalette.SelectedColorBrush = new SolidColorBrush(View.Instance.ApplicationColorSet.SelectionOutlineColor);
                    break;
                }
                ColorPaletteContainer.Visibility = System.Windows.Visibility.Visible;
            }
        }
        void ColorPalette_ColorPicked(object sender, ColorChosenEventArgs e)
        {
            ListBoxItem selectedItem = ColorOptionComboBox.SelectedItem as ListBoxItem;

            if (selectedItem == null)
            {
                return;
            }
            string colorOption = selectedItem.Tag as string;

            if (string.IsNullOrEmpty(colorOption))
            {
                return;
            }

            ThemeColorProperty property = (ThemeColorProperty)Enum.Parse(typeof(ThemeColorProperty), colorOption, true);

            ThemeColorHelper.ApplyColorProperty(View.Instance.ApplicationColorSet, e.Color, property);
        }
Beispiel #5
0
 set => this.SetValue(ThemeColorProperty, value);
Beispiel #6
0
        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;
            }
        }
 set => SetValue(ThemeColorProperty, value);