private void colorRect_MouseDown(object sender, MouseButtonEventArgs e) { var dia = new ColorPickerFullDialog(); dia.InitialColor =((SolidColorBrush ) colorRect.Fill).Color ; //set the initial color if (dia.ShowDialog() == true) { colorRect.Fill = new SolidColorBrush(dia.SelectedColor); //do something with the selected color } }
private IColorDialog CreateDialog() { IColorDialog dialog = null; switch (ColorDialog) { case EColorDialog.Full: dialog = new ColorPickerFullDialog(); break; case EColorDialog.FullWithAlpha: dialog = new ColorPickerFullWithAlphaDialog(); break; case EColorDialog.Standard: dialog = new ColorPickerStandardDialog(); break; case EColorDialog.StandardWithAlpha : dialog = new ColorPickerStandardWithAlphaDialog(); break; } return dialog; }