private void Button_Click(object sender, RoutedEventArgs e) { ColorPickerControls.Dialogs.ColorPickerFullDialog dlg = new ColorPickerControls.Dialogs.ColorPickerFullDialog(); UnitLight light = ((UnitLight)lbLights.SelectedItem); dlg.InitialColor = ((UnitLight)lbLights.SelectedItem).LightColor.Color; if (dlg.ShowDialog().GetValueOrDefault(false)) { light.LightColor.Color = dlg.SelectedColor; } }
private void Button_Click(object sender, RoutedEventArgs e) { if (this.DataContext is ColorRGBProperty) { ColorRGBProperty prop = (ColorRGBProperty)this.DataContext; Color color = Color.FromRgb((byte)(prop.R * 255), (byte)(prop.G * 255), (byte)(prop.B * 255)); ColorPickerControls.Dialogs.ColorPickerFullDialog dlg = new ColorPickerControls.Dialogs.ColorPickerFullDialog(); dlg.InitialColor = color; if (dlg.ShowDialog().GetValueOrDefault(false)) { color = dlg.SelectedColor; } prop.R = (float)color.R / 255; prop.G = (float)color.G / 255; prop.B = (float)color.B / 255; rectColorSample.Fill = new SolidColorBrush(color); prop.OnPropertyChanged(new EventArgs()); } else if (this.DataContext is ColorRGBAProperty) { ColorRGBAProperty prop = (ColorRGBAProperty)this.DataContext; Color color = Color.FromArgb((byte)(prop.A * 255), (byte)(prop.R * 255), (byte)(prop.G * 255), (byte)(prop.B * 255)); ColorPickerControls.Dialogs.ColorPickerFullWithAlphaDialog dlg = new ColorPickerControls.Dialogs.ColorPickerFullWithAlphaDialog(); dlg.InitialColor = color; if (dlg.ShowDialog().GetValueOrDefault(false)) { color = dlg.SelectedColor; } prop.A = (float)color.A / 255; prop.R = (float)color.R / 255; prop.G = (float)color.G / 255; prop.B = (float)color.B / 255; rectColorSample.Fill = new SolidColorBrush(color); prop.OnPropertyChanged(new EventArgs()); } var expression = txtColor.GetBindingExpression(TextBlock.TextProperty); if (expression != null) { expression.UpdateSource(); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { ColorPickerControls.Dialogs.ColorPickerFullDialog dlg = new ColorPickerControls.Dialogs.ColorPickerFullDialog(); DecalImageModel decal = this.DataContext as DecalImageModel; dlg.InitialColor = decal.Color3; if (dlg.ShowDialog().GetValueOrDefault(false)) { decal.Color3 = dlg.SelectedColor; } var expression = rectangle3.GetBindingExpression(Border.BackgroundProperty); if (expression != null) { expression.UpdateTarget(); } RefreshImage(); }
private void Button_Click(object sender, RoutedEventArgs e) { ColorPickerControls.Dialogs.ColorPickerFullDialog dlg = new ColorPickerControls.Dialogs.ColorPickerFullDialog(); UnitLight light = ((UnitLight)this.DataContext); dlg.InitialColor = light.LightColor.Color; if (dlg.ShowDialog().GetValueOrDefault(false)) { light.LightColor.Color = dlg.SelectedColor; } var expression = rectangle1.GetBindingExpression(Border.BackgroundProperty); if (expression != null) { expression.UpdateTarget(); } light.UpdateGeometry(); }