public WindowCustomizeColorsByValue(Window owner, Color defaultColor, HudColorsByValueParams.HudColorsByValueType hudColorsByValueType) { InitializeComponent(); Owner = owner; WindowStartupLocation = WindowStartupLocation.CenterOwner; HudColorsByValueParams = new HudColorsByValueParams(hudColorsByValueType); UcColorPreview_ColorDefault.Color = defaultColor; UcColorPreview_ColorDefault.Owner = owner; UcColorPreview_ColorDefault.ColorChanged += (sender, args) => HudColorsByValueParams.ColorDefault = UcColorPreview_ColorDefault.Color; foreach (var colorByValue in HudColorsByValueParams.ColorsByValue) { StackPanel_ColorsByValue.Children.Add(new UCColorByValue(this, StackPanel_ColorsByValue, colorByValue)); } }