Hello. On the form there is an element ColorPicker, how to change the color when you click on the button. So the color does not change.
DirectionalLight dl = new DirectionalLight(); dl.Color = customCPDirectionalLight.SelectedColor;
Addition.
private void ApplyButtonDirectionalLight_Click(object sender, RoutedEventArgs e) { win.customCPDirectionalLight.SelectedColorChanged += new Action<System.Windows.Media.Color> (customCPDirectionalLight_SelectedColorChanged); } public void customCPDirectionalLight_SelectedColorChanged(System.Windows.Media.Color obj) { MGroup.Children.Clear(); DirectionalLight dl = new DirectionalLight(); dl.Color = (System.Windows.Media.Color) obj; MGroup.Children.Add(dl); }