private void BrowseButton_Click(object sender, RoutedEventArgs e) { // https://www.codeproject.com/Articles/131708/WPF-Color-Picker-Construction-Kit ColorPickerStandardDialog colorDialog = new ColorPickerStandardDialog(); colorDialog.InitialColor = ((SolidColorBrush)this.lblColor.Background).Color; if (colorDialog.ShowDialog().GetValueOrDefault()) { lblColor.Background = new SolidColorBrush(colorDialog.SelectedColor); Ds4BatteryColor = BrushToUInt(lblColor.Background); } }
private IColorDialog CreateDialog() { IColorDialog dialog = null; switch (ColorDialog) { case EColorDialog.Full: dialog = new ColorPickerFullDialog { Owner = Window.GetWindow(this) }; break; case EColorDialog.FullWithAlpha: dialog = new ColorPickerFullWithAlphaDialog { Owner = Window.GetWindow(this) }; break; case EColorDialog.Standard: dialog = new ColorPickerStandardDialog { Owner = Window.GetWindow(this) }; break; case EColorDialog.StandardWithAlpha: dialog = new ColorPickerStandardWithAlphaDialog { Owner = Window.GetWindow(this) }; break; } return(dialog); }