private void ColorDlgButton_Click(object sender, RoutedEventArgs e) { // RaiseEvent(new RibbonDismissPopupEventArgs(RibbonDismissPopupMode.Always)); //PART_Popup.StaysOpen = true; _bIsShowDlgStatus = true; Popup popRoot = GetPopUpRoot(); popRoot.StaysOpen = true; popRoot.IsOpen = true; ///Load custom color var customcolor = default(int[]); try { //var dsRegkey = Registry.CurrentUser.OpenSubKey(@"Software\Design Studio"); //if (dsRegkey != null) //{ // var customColorobj = dsRegkey.GetValue("CustomColor"); // if (customColorobj != null) // { // customcolor = customColorobj.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray(); // } //} var customColorStre = ConfigFileManager.GetValue("CustomColor"); if (!string.IsNullOrEmpty(customColorStre)) { customcolor = customColorStre.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray(); } } catch { } System.Windows.Forms.ColorDialog colorDialog = new ColorDialog(); colorDialog.AllowFullOpen = true; if (customcolor != null && customcolor.Length > 0) { colorDialog.CustomColors = customcolor; } popRoot.StaysOpen = true; var cdialogrst = colorDialog.ShowDialog(); ///save custom color if (colorDialog.CustomColors != null && colorDialog.CustomColors.Length > 0) { ConfigFileManager.SetValue("CustomColor", string.Join(",", colorDialog.CustomColors)); } if (cdialogrst == System.Windows.Forms.DialogResult.OK) { System.Windows.Media.Color Color32 = new System.Windows.Media.Color(); Color32.A = colorDialog.Color.A; Color32.B = colorDialog.Color.B; Color32.G = colorDialog.Color.G; Color32.R = colorDialog.Color.R; ColorPanelShow.Fill = new SolidColorBrush(Color32); //set color-32 information string sARGB = ColorPanelShow.Fill.ToString(); string sRGB = @"#" + sARGB.Substring(3, sARGB.Length - 3); ColorInfoShow.Text = sRGB; //Invoke the command _bIsShowDlgStatus = false; //ColorSelected = Color32; if (this.IsSolidType()) { ColorSelected = new StyleColor(ColorFillType.Solid, Color32.ToArgb()); InvokeCommand(ColorSelected); } else { GradientEditor1.SelectedColor = Color32; _bIsShowDlgStatus = false; popRoot.IsOpen = true; } } else { _bIsShowDlgStatus = false; popRoot.IsOpen = true; } }