예제 #1
0
 protected override void OnValueChanged(DependencyPropertyChangedEventArgs e)
 {
     if (!this.autoSettingValue)
     {
         if (e.NewValue is Color)
         {
             this.SelectedPaletteColor = null;
             this.Color = (Color)e.NewValue;
         }
         else if (this.Value is PaletteColor)
         {
             this.SelectedPaletteColor = (PaletteColor)this.Value;
         }
     }
 }
        public static Theme LoadTheme(XElement element)
        {
            try
            {
                var themeType = Type.GetType(element.Attribute("Type").Value);
                var theme     = Activator.CreateInstance(themeType) as Theme;

                var validProps = theme.GetType().GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy)
                                 .Where(fi => fi.FieldType == typeof(DependencyProperty))
                                 .Select(fi => (DependencyProperty)fi.GetValue(null))
                                 .Where(dp => !dp.ReadOnly)
                                 .ToDictionary(dp => dp.Name);
                var converters     = new Dictionary <Type, TypeConverter>();
                var paletteElement = element.Element("Palette");
                var palette        = new Dictionary <string, PaletteColor>();

                if (paletteElement != null)
                {
                    var colorConverter = TypeDescriptor.GetConverter(typeof(Color));

                    converters[typeof(Color)] = colorConverter;

                    foreach (var colorElement in paletteElement.Elements("PaletteColor"))
                    {
                        var paletteColor = new PaletteColor
                        {
                            Name  = colorElement.Attribute("Name").Value,
                            Color = (Color)colorConverter.ConvertFromString(null, CultureInfo.InvariantCulture, colorElement.Attribute("Color").Value)
                        };

                        palette[paletteColor.Name] = paletteColor;
                    }

                    // NOTE:  We add the palette entries after loading them all to remove any duplicates.
                    // If the user names palette colors the same, they'll work independently until saved.
                    // When loaded, they'll be unified.  Not awesome, but better than crashing.
                    theme.Palette.Clear();
                    foreach (var pc in palette.Values)
                    {
                        theme.Palette.Add(pc);
                    }
                }

                foreach (var propElement in element.Elements("Property"))
                {
                    var nameAttr  = propElement.Attribute("Name");
                    var valueAttr = propElement.Attribute("Value");

                    if (nameAttr != null)
                    {
                        DependencyProperty dp;
                        object             value;

                        if (validProps.TryGetValue(nameAttr.Value, out dp))
                        {
                            if (dp.PropertyType == typeof(Color) && valueAttr.Value.StartsWith("="))
                            {
                                PaletteColor paletteColor;

                                if (palette.TryGetValue(valueAttr.Value.Substring(1), out paletteColor))
                                {
                                    BindingOperations.SetBinding(theme, dp, new Binding {
                                        Source = paletteColor, Path = new PropertyPath(PaletteColor.ColorProperty)
                                    });
                                }
                            }
                            else
                            {
                                if (dp.PropertyType == typeof(string))
                                {
                                    value = valueAttr.Value;
                                }
                                else
                                {
                                    TypeConverter converter;

                                    if (!converters.TryGetValue(dp.PropertyType, out converter))
                                    {
                                        converter = TypeDescriptor.GetConverter(dp.PropertyType);
                                        converters[dp.PropertyType] = converter;
                                    }

                                    value = converter.ConvertFromString(valueAttr.Value);
                                }

                                theme.SetValue(dp, value);
                            }
                        }
                    }
                }

                return(theme);
            }
            catch (Exception)
            {
                return(Theme.Instance.ThemeCreator());
            }
        }
        void SetBindings()
        {
            var palette = this.Palette.ToDictionary(pc => pc.Name);

            if (!palette.ContainsKey("Black"))
            {
                var pc = new PaletteColor { Name = "Black", Color = Color.FromArgb(0xFF, 0x00, 0x00, 0x00) };
                palette["Black"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("White"))
            {
                var pc = new PaletteColor { Name = "White", Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF) };
                palette["White"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("Gray"))
            {
                var pc = new PaletteColor { Name = "Gray", Color = Color.FromArgb(0xFF, 0x80, 0x80, 0x80) };
                palette["Gray"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("MediumGray"))
            {
                var pc = new PaletteColor { Name = "MediumGray", Color = Color.FromArgb(0xFF, 0xB8, 0xB8, 0xB8) };
                palette["MediumGray"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("LightGray"))
            {
                var pc = new PaletteColor { Name = "LightGray", Color = Color.FromArgb(0xFF, 0xD9, 0xD9, 0xD9) };
                palette["LightGray"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("LighterGray"))
            {
                var pc = new PaletteColor { Name = "LighterGray", Color = Color.FromArgb(0xFF, 0xE5, 0xE5, 0xE5) };
                palette["LighterGray"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("XboxGreen"))
            {
                var pc = new PaletteColor { Name = "XboxGreen", Color = Color.FromArgb(0xFF, 0x10, 0x7C, 0x0F) };
                palette["XboxGreen"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("XboxGreenLight"))
            {
                var pc = new PaletteColor { Name = "XboxGreenLight", Color = Color.FromArgb(0xFF, 0xC4, 0xEE, 0xB3) };
                palette["XboxGreenLight"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("XboxGreenMedium"))
            {
                var pc = new PaletteColor { Name = "XboxGreenMedium", Color = Color.FromArgb(0xFF, 0x3F, 0xAC, 0x30) };
                palette["XboxGreenMedium"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("XboxGreenDark"))
            {
                var pc = new PaletteColor { Name = "XboxGreenDark", Color = Color.FromArgb(0xFF, 0x10, 0x66, 0x0F) };
                palette["XboxGreenDark"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("Transparent"))
            {
                var pc = new PaletteColor { Name = "Transparent", Color = Color.FromArgb(0x00, 0xFF, 0xFF, 0xFF) };
                palette["Transparent"] = pc;
                this.Palette.Add(pc);
            }

            if (!palette.ContainsKey("TimelineSelection"))
            {
                var pc = new PaletteColor { Name = "TimelineSelection", Color = Color.FromArgb(0x86, 0xC4, 0xEE, 0xB3) };
                palette["TimelineSelection"] = pc;
                this.Palette.Add(pc);
            }

            this.BladePageHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.BladePageHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(BladePageHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, BladePageHoverBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.BladePageHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.BladePageHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(BladePageHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, BladePageHoverForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ComboBoxDropdownBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ComboBoxDropdownBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ComboBoxDropdownBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ComboBoxDropdownBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ComboBoxItemHighlightedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ComboBoxItemHighlightedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ComboBoxItemHighlightedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ComboBoxItemHighlightedBackgroundColorProperty, new Binding { Source = palette["XboxGreenLight"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ComboBoxItemHighlightedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ComboBoxItemHighlightedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ComboBoxItemHighlightedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ComboBoxItemHighlightedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ComboBoxItemSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ComboBoxItemSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ComboBoxItemSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ComboBoxItemSelectedBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ComboBoxItemSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ComboBoxItemSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ComboBoxItemSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ComboBoxItemSelectedForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ControlBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlBorderColorProperty) });
            BindingOperations.SetBinding(this, ControlBorderColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlDisabledBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlDisabledBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlDisabledBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ControlDisabledBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlDisabledBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlDisabledBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlDisabledBorderColorProperty) });
            BindingOperations.SetBinding(this, ControlDisabledBorderColorProperty, new Binding { Source = palette["LighterGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlDisabledForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlDisabledForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlDisabledForegroundColorProperty) });
            BindingOperations.SetBinding(this, ControlDisabledForegroundColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlFocusedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlFocusedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlFocusedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ControlFocusedBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlFocusedBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlFocusedBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlFocusedBorderColorProperty) });
            BindingOperations.SetBinding(this, ControlFocusedBorderColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlFocusedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlFocusedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlFocusedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ControlFocusedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlFocusedHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlFocusedHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlFocusedHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ControlFocusedHoverBackgroundColorProperty, new Binding { Source = palette["XboxGreenLight"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlFocusedHoverBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlFocusedHoverBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlFocusedHoverBorderColorProperty) });
            BindingOperations.SetBinding(this, ControlFocusedHoverBorderColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlFocusedHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlFocusedHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlFocusedHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, ControlFocusedHoverForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlForegroundColorProperty) });
            BindingOperations.SetBinding(this, ControlForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ControlHoverBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlHoverBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlHoverBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlHoverBorderColorProperty) });
            BindingOperations.SetBinding(this, ControlHoverBorderColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, ControlHoverForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlPressedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlPressedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlPressedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ControlPressedBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlPressedBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlPressedBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlPressedBorderColorProperty) });
            BindingOperations.SetBinding(this, ControlPressedBorderColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ControlPressedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ControlPressedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ControlPressedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ControlPressedForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.DarkFocusVisualBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.DarkFocusVisualBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(DarkFocusVisualColorProperty) });
            BindingOperations.SetBinding(this, DarkFocusVisualColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.LightFocusVisualBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.LightFocusVisualBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(LightFocusVisualColorProperty) });
            BindingOperations.SetBinding(this, LightFocusVisualColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.EventLaneFocusedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.EventLaneFocusedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(EventLaneFocusedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, EventLaneFocusedBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.EventLaneFocusedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.EventLaneFocusedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(EventLaneFocusedForegroundColorProperty) });
            BindingOperations.SetBinding(this, EventLaneFocusedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.EventLaneFocusedSelectionBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.EventLaneFocusedSelectionBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(EventLaneFocusedSelectionBackgroundColorProperty) });
            BindingOperations.SetBinding(this, EventLaneFocusedSelectionBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.EventLaneFocusedSelectionForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.EventLaneFocusedSelectionForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(EventLaneFocusedSelectionForegroundColorProperty) });
            BindingOperations.SetBinding(this, EventLaneFocusedSelectionForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.EventLaneSelectionBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.EventLaneSelectionBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(EventLaneSelectionBackgroundColorProperty) });
            BindingOperations.SetBinding(this, EventLaneSelectionBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.EventLaneSelectionForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.EventLaneSelectionForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(EventLaneSelectionForegroundColorProperty) });
            BindingOperations.SetBinding(this, EventLaneSelectionForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.Heading1ForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.Heading1ForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(Heading1ForegroundColorProperty) });
            BindingOperations.SetBinding(this, Heading1ForegroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.Heading2ForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.Heading2ForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(Heading2ForegroundColorProperty) });
            BindingOperations.SetBinding(this, Heading2ForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.GroupBoxHeaderBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.GroupBoxHeaderBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(GroupBoxHeaderBackgroundColorProperty) });
            BindingOperations.SetBinding(this, GroupBoxHeaderBackgroundColorProperty, new Binding { Source = palette["LighterGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.GroupBoxHeaderForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.GroupBoxHeaderForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(GroupBoxHeaderForegroundColorProperty) });
            BindingOperations.SetBinding(this, GroupBoxHeaderForegroundColorProperty, new Binding { Source = palette["XboxGreenDark"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.CloseFileButtonForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.CloseFileButtonForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(CloseFileButtonForegroundColorProperty) });
            BindingOperations.SetBinding(this, CloseFileButtonForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.CloseFileButtonHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.CloseFileButtonHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(CloseFileButtonHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, CloseFileButtonHoverForegroundColorProperty, new Binding { Source = palette["XboxGreenLight"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileButtonBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileButtonBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileButtonBackgroundColorProperty) });
            BindingOperations.SetBinding(this, FileButtonBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileButtonForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileButtonForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileButtonForegroundColorProperty) });
            BindingOperations.SetBinding(this, FileButtonForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileButtonHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileButtonHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileButtonHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, FileButtonHoverBackgroundColorProperty, new Binding { Source = palette["XboxGreenMedium"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileButtonHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileButtonHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileButtonHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, FileButtonHoverForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileTabItemBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileTabItemBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileTabItemBackgroundColorProperty) });
            BindingOperations.SetBinding(this, FileTabItemBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileTabItemDisabledBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileTabItemDisabledBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileTabItemDisabledBackgroundColorProperty) });
            BindingOperations.SetBinding(this, FileTabItemDisabledBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileTabItemDisabledForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileTabItemDisabledForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileTabItemDisabledForegroundColorProperty) });
            BindingOperations.SetBinding(this, FileTabItemDisabledForegroundColorProperty, new Binding { Source = palette["XboxGreenLight"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileTabItemForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileTabItemForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileTabItemForegroundColorProperty) });
            BindingOperations.SetBinding(this, FileTabItemForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileTabItemHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileTabItemHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileTabItemHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, FileTabItemHoverBackgroundColorProperty, new Binding { Source = palette["XboxGreenDark"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileTabItemHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileTabItemHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileTabItemHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, FileTabItemHoverForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileTabItemSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileTabItemSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileTabItemSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, FileTabItemSelectedBackgroundColorProperty, new Binding { Source = palette["XboxGreenMedium"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.FileTabItemSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.FileTabItemSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(FileTabItemSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, FileTabItemSelectedForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.LayoutTabControlBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.LayoutTabControlBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(LayoutTabControlBackgroundColorProperty) });
            BindingOperations.SetBinding(this, LayoutTabControlBackgroundColorProperty, new Binding { Source = palette["LighterGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.LayoutTabItemBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.LayoutTabItemBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(LayoutTabItemBackgroundColorProperty) });
            BindingOperations.SetBinding(this, LayoutTabItemBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.LayoutTabItemBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.LayoutTabItemBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(LayoutTabItemBorderColorProperty) });
            BindingOperations.SetBinding(this, LayoutTabItemBorderColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.LayoutTabItemForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.LayoutTabItemForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(LayoutTabItemForegroundColorProperty) });
            BindingOperations.SetBinding(this, LayoutTabItemForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.LayoutTabItemHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.LayoutTabItemHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(LayoutTabItemHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, LayoutTabItemHoverBackgroundColorProperty, new Binding { Source = palette["Transparent"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.LayoutTabItemHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.LayoutTabItemHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(LayoutTabItemHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, LayoutTabItemHoverForegroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.LayoutTabItemSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.LayoutTabItemSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(LayoutTabItemSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, LayoutTabItemSelectedBackgroundColorProperty, new Binding { Source = palette["LighterGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.LayoutTabItemSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.LayoutTabItemSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(LayoutTabItemSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, LayoutTabItemSelectedForegroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.OpenTabBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.OpenTabBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(OpenTabBorderColorProperty) });
            BindingOperations.SetBinding(this, OpenTabBorderColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.OpenTabItemBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.OpenTabItemBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(OpenTabItemBackgroundColorProperty) });
            BindingOperations.SetBinding(this, OpenTabItemBackgroundColorProperty, new Binding { Source = palette["Transparent"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.OpenTabItemForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.OpenTabItemForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(OpenTabItemForegroundColorProperty) });
            BindingOperations.SetBinding(this, OpenTabItemForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.OpenTabItemHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.OpenTabItemHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(OpenTabItemHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, OpenTabItemHoverBackgroundColorProperty, new Binding { Source = palette["XboxGreenLight"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.OpenTabItemHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.OpenTabItemHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(OpenTabItemHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, OpenTabItemHoverForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.OpenTabItemSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.OpenTabItemSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(OpenTabItemSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, OpenTabItemSelectedBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.OpenTabItemSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.OpenTabItemSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(OpenTabItemSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, OpenTabItemSelectedForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ListBoxItemFocusedSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ListBoxItemFocusedSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ListBoxItemFocusedSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ListBoxItemFocusedSelectedBackgroundColorProperty, new Binding { Source = palette["XboxGreenLight"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ListBoxItemFocusedSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ListBoxItemFocusedSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ListBoxItemFocusedSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ListBoxItemFocusedSelectedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ListBoxItemSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ListBoxItemSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ListBoxItemSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ListBoxItemSelectedBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ListBoxItemSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ListBoxItemSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ListBoxItemSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ListBoxItemSelectedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.WindowBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.WindowBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(WindowBackgroundColorProperty) });
            BindingOperations.SetBinding(this, WindowBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.WindowTitleForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.WindowTitleForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(WindowTitleForegroundColorProperty) });
            BindingOperations.SetBinding(this, WindowTitleForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.WindowTitleInactiveForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.WindowTitleInactiveForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(WindowTitleInactiveForegroundColorProperty) });
            BindingOperations.SetBinding(this, WindowTitleInactiveForegroundColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ScrollBarThumbBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ScrollBarThumbBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ScrollBarThumbColorProperty) });
            BindingOperations.SetBinding(this, ScrollBarThumbColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ScrollBarThumbHoverBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ScrollBarThumbHoverBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ScrollBarThumbHoverColorProperty) });
            BindingOperations.SetBinding(this, ScrollBarThumbHoverColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ScrollBarThumbPressedBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ScrollBarThumbPressedBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ScrollBarThumbPressedColorProperty) });
            BindingOperations.SetBinding(this, ScrollBarThumbPressedColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabControlActiveBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabControlActiveBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabControlActiveBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TabControlActiveBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabControlActiveBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabControlActiveBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabControlActiveBorderColorProperty) });
            BindingOperations.SetBinding(this, TabControlActiveBorderColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabControlBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabControlBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabControlBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TabControlBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabControlBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabControlBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabControlBorderColorProperty) });
            BindingOperations.SetBinding(this, TabControlBorderColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemActiveBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemActiveBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemActiveBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemActiveBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemActiveBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemActiveBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemActiveBorderColorProperty) });
            BindingOperations.SetBinding(this, TabItemActiveBorderColorProperty, new Binding { Source = palette["Transparent"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemActiveForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemActiveForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemActiveForegroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemActiveForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemActiveSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemActiveSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemActiveSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemActiveSelectedBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemActiveSelectedBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemActiveSelectedBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemActiveSelectedBorderColorProperty) });
            BindingOperations.SetBinding(this, TabItemActiveSelectedBorderColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemActiveSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemActiveSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemActiveSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemActiveSelectedForegroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemBorderColorProperty) });
            BindingOperations.SetBinding(this, TabItemBorderColorProperty, new Binding { Source = palette["Transparent"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemForegroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemForegroundColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemHoverBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemHoverBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemHoverBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemHoverBorderColorProperty) });
            BindingOperations.SetBinding(this, TabItemHoverBorderColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemHoverForegroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemSelectedBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemSelectedBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemSelectedBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemSelectedBorderColorProperty) });
            BindingOperations.SetBinding(this, TabItemSelectedBorderColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabItemSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabItemSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabItemSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, TabItemSelectedForegroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabPanelActiveBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabPanelActiveBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabPanelActiveBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TabPanelActiveBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabPanelBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabPanelBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabPanelBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TabPanelBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TabPanelBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TabPanelBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TabPanelBorderColorProperty) });
            BindingOperations.SetBinding(this, TabPanelBorderColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TextBoxSelectionBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TextBoxSelectionBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TextBoxSelectionColorProperty) });
            BindingOperations.SetBinding(this, TextBoxSelectionColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TextEditorFocusedSelectionBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TextEditorFocusedSelectionBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TextEditorFocusedSelectionBorderColorProperty) });
            BindingOperations.SetBinding(this, TextEditorFocusedSelectionBorderColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TextEditorFocusedSelectionBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TextEditorFocusedSelectionBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TextEditorFocusedSelectionColorProperty) });
            this.TextEditorSelectionBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TextEditorSelectionBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TextEditorSelectionBorderColorProperty) });
            BindingOperations.SetBinding(this, TextEditorSelectionBorderColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TextEditorSelectionBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TextEditorSelectionBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TextEditorSelectionColorProperty) });
            this.TimelineSelectionBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TimelineSelectionBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TimelineSelectionBorderColorProperty) });
            BindingOperations.SetBinding(this, TimelineSelectionBorderColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TimelineSelectionBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TimelineSelectionBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TimelineSelectionColorProperty) });
            BindingOperations.SetBinding(this, TimelineSelectionColorProperty, new Binding { Source = palette["TimelineSelection"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TimelineMousePointBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TimelineMousePointBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TimelineMousePointColorProperty) });
            this.ToggleButtonCheckedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonCheckedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonCheckedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonCheckedBackgroundColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonCheckedBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonCheckedBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonCheckedBorderColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonCheckedBorderColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonCheckedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonCheckedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonCheckedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonCheckedForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonDisabledCheckedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonDisabledCheckedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonDisabledCheckedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonDisabledCheckedBackgroundColorProperty, new Binding { Source = palette["LighterGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonDisabledCheckedBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonDisabledCheckedBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonDisabledCheckedBorderColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonDisabledCheckedBorderColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonDisabledCheckedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonDisabledCheckedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonDisabledCheckedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonDisabledCheckedForegroundColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonFocusedCheckedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonFocusedCheckedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonFocusedCheckedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonFocusedCheckedBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonFocusedCheckedBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonFocusedCheckedBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonFocusedCheckedBorderColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonFocusedCheckedBorderColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonFocusedCheckedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonFocusedCheckedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonFocusedCheckedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonFocusedCheckedForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonHoverCheckedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonHoverCheckedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonHoverCheckedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonHoverCheckedBackgroundColorProperty, new Binding { Source = palette["XboxGreenDark"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonHoverCheckedBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonHoverCheckedBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonHoverCheckedBorderColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonHoverCheckedBorderColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ToggleButtonHoverCheckedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ToggleButtonHoverCheckedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ToggleButtonHoverCheckedForegroundColorProperty) });
            BindingOperations.SetBinding(this, ToggleButtonHoverCheckedForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridCurrentRowBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridCurrentRowBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridCurrentRowBorderColorProperty) });
            BindingOperations.SetBinding(this, TreeGridCurrentRowBorderColorProperty, new Binding { Source = palette["MediumGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridFocusedCurrentRowBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridFocusedCurrentRowBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridFocusedCurrentRowBorderColorProperty) });
            BindingOperations.SetBinding(this, TreeGridFocusedCurrentRowBorderColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridFocusedSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridFocusedSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridFocusedSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridFocusedSelectedBackgroundColorProperty, new Binding { Source = palette["XboxGreenLight"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridFocusedSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridFocusedSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridFocusedSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridFocusedSelectedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderFocusedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderFocusedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderFocusedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderFocusedBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderFocusedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderFocusedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderFocusedForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderFocusedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderFocusedHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderFocusedHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderFocusedHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderFocusedHoverBackgroundColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderFocusedHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderFocusedHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderFocusedHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderFocusedHoverForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderHoverBackgroundColorProperty, new Binding { Source = palette["Gray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderHoverForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderPressedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderPressedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderPressedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderPressedBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridHeaderPressedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridHeaderPressedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridHeaderPressedForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridHeaderPressedForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridLinesBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridLinesBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridLinesColorProperty) });
            BindingOperations.SetBinding(this, TreeGridLinesColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridSelectedBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeGridSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeGridSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeGridSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeGridSelectedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeViewItemFocusedSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeViewItemFocusedSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeViewItemFocusedSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeViewItemFocusedSelectedBackgroundColorProperty, new Binding { Source = palette["XboxGreenLight"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeViewItemFocusedSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeViewItemFocusedSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeViewItemFocusedSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeViewItemFocusedSelectedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeViewItemSelectedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeViewItemSelectedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeViewItemSelectedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TreeViewItemSelectedBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TreeViewItemSelectedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TreeViewItemSelectedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TreeViewItemSelectedForegroundColorProperty) });
            BindingOperations.SetBinding(this, TreeViewItemSelectedForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ViewBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ViewBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ViewBackgroundColorProperty) });
            BindingOperations.SetBinding(this, ViewBackgroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.ViewBorderBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.ViewBorderBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(ViewBorderColorProperty) });
            BindingOperations.SetBinding(this, ViewBorderColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.AccentBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.AccentBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(AccentBackgroundColorProperty) });
            BindingOperations.SetBinding(this, AccentBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.AccentForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.AccentForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(AccentForegroundColorProperty) });
            BindingOperations.SetBinding(this, AccentForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TitleBarButtonBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TitleBarButtonBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TitleBarButtonBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TitleBarButtonBackgroundColorProperty, new Binding { Source = palette["LightGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TitleBarButtonForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TitleBarButtonForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TitleBarButtonForegroundColorProperty) });
            BindingOperations.SetBinding(this, TitleBarButtonForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TitleBarButtonHoverBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TitleBarButtonHoverBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TitleBarButtonHoverBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TitleBarButtonHoverBackgroundColorProperty, new Binding { Source = palette["LighterGray"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TitleBarButtonHoverForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TitleBarButtonHoverForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TitleBarButtonHoverForegroundColorProperty) });
            BindingOperations.SetBinding(this, TitleBarButtonHoverForegroundColorProperty, new Binding { Source = palette["Black"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TitleBarButtonPressedBackgroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TitleBarButtonPressedBackgroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TitleBarButtonPressedBackgroundColorProperty) });
            BindingOperations.SetBinding(this, TitleBarButtonPressedBackgroundColorProperty, new Binding { Source = palette["XboxGreen"], Path = new PropertyPath(PaletteColor.ColorProperty) });
            this.TitleBarButtonPressedForegroundBrush = new SolidColorBrush();
            BindingOperations.SetBinding(this.TitleBarButtonPressedForegroundBrush, SolidColorBrush.ColorProperty, new Binding { Source = this, Path = new PropertyPath(TitleBarButtonPressedForegroundColorProperty) });
            BindingOperations.SetBinding(this, TitleBarButtonPressedForegroundColorProperty, new Binding { Source = palette["White"], Path = new PropertyPath(PaletteColor.ColorProperty) });
        }
 protected override void OnValueChanged(DependencyPropertyChangedEventArgs e)
 {
     if (!this.autoSettingValue)
     {
         if (e.NewValue is Color)
         {
             this.SelectedPaletteColor = null;
             this.Color = (Color)e.NewValue;
         }
         else if (this.Value is PaletteColor)
         {
             this.SelectedPaletteColor = (PaletteColor)this.Value;
         }
     }
 }
        public static Theme LoadTheme(XElement element)
        {
            try
            {
                var themeType = Type.GetType(element.Attribute("Type").Value);
                var theme = Activator.CreateInstance(themeType) as Theme;

                var validProps = theme.GetType().GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy)
                    .Where(fi => fi.FieldType == typeof(DependencyProperty))
                    .Select(fi => (DependencyProperty)fi.GetValue(null))
                    .Where(dp => !dp.ReadOnly)
                    .ToDictionary(dp => dp.Name);
                var converters = new Dictionary<Type, TypeConverter>();
                var paletteElement = element.Element("Palette");
                var palette = new Dictionary<string, PaletteColor>();

                if (paletteElement != null)
                {
                    var colorConverter = TypeDescriptor.GetConverter(typeof(Color));

                    converters[typeof(Color)] = colorConverter;

                    foreach (var colorElement in paletteElement.Elements("PaletteColor"))
                    {
                        var paletteColor = new PaletteColor
                        {
                            Name = colorElement.Attribute("Name").Value,
                            Color = (Color)colorConverter.ConvertFromString(null, CultureInfo.InvariantCulture, colorElement.Attribute("Color").Value)
                        };

                        palette[paletteColor.Name] = paletteColor;
                    }

                    // NOTE:  We add the palette entries after loading them all to remove any duplicates.
                    // If the user names palette colors the same, they'll work independently until saved.
                    // When loaded, they'll be unified.  Not awesome, but better than crashing.
                    theme.Palette.Clear();
                    foreach (var pc in palette.Values)
                    {
                        theme.Palette.Add(pc);
                    }
                }

                foreach (var propElement in element.Elements("Property"))
                {
                    var nameAttr = propElement.Attribute("Name");
                    var valueAttr = propElement.Attribute("Value");

                    if (nameAttr != null)
                    {
                        DependencyProperty dp;
                        object value;

                        if (validProps.TryGetValue(nameAttr.Value, out dp))
                        {
                            if (dp.PropertyType == typeof(Color) && valueAttr.Value.StartsWith("="))
                            {
                                PaletteColor paletteColor;

                                if (palette.TryGetValue(valueAttr.Value.Substring(1), out paletteColor))
                                {
                                    BindingOperations.SetBinding(theme, dp, new Binding { Source = paletteColor, Path = new PropertyPath(PaletteColor.ColorProperty) });
                                }
                            }
                            else
                            {
                                if (dp.PropertyType == typeof(string))
                                {
                                    value = valueAttr.Value;
                                }
                                else
                                {
                                    TypeConverter converter;

                                    if (!converters.TryGetValue(dp.PropertyType, out converter))
                                    {
                                        converter = TypeDescriptor.GetConverter(dp.PropertyType);
                                        converters[dp.PropertyType] = converter;
                                    }

                                    value = converter.ConvertFromString(valueAttr.Value);
                                }

                                theme.SetValue(dp, value);
                            }
                        }
                    }
                }

                return theme;
            }
            catch (Exception)
            {
                return Theme.Instance.ThemeCreator();
            }
        }