private void buttonSelectColor_Click(object sender, RoutedEventArgs e) { ColorDialog colorDialog = new ColorDialog { SelectedColor = ((SolidColorBrush) PhotonColor.Fill).Color, Owner = this }; if ((bool)colorDialog.ShowDialog()) PhotonColor.Fill = new SolidColorBrush(colorDialog.SelectedColor); }
/// <summary> /// DEMO CODE /// </summary> private void btnPickColor_Click(object sender, RoutedEventArgs e) { //ColorDialog colorDialog = new ColorDialog(((SolidColorBrush)this.RectColorPicked.Fill).Color); ColorDialog colorDialog = new ColorDialog(); colorDialog.SelectedColor = ((SolidColorBrush)this.RectColorPicked.Fill).Color; colorDialog.Owner = this; if ((bool)colorDialog.ShowDialog()) { RectColorPicked.Fill = new SolidColorBrush(colorDialog.SelectedColor); } }
private void Button_Click(object sender, RoutedEventArgs e) { ColorDialog colorDialog = new ColorDialog(); colorDialog.SelectedColor = ((SolidColorBrush)this.rectColor.Fill).Color; colorDialog.Owner = this; var current = this.Background; this.Background = new SolidColorBrush(Colors.LightGray); this.Effect = new BlurEffect(); if ((bool)colorDialog.ShowDialog()) rectColor.Fill = new SolidColorBrush(colorDialog.SelectedColor); this.Effect = null; this.Background = current; }