-3

How can I change button background color by using Xceed ColorPicker on a click event Button

kurub
  • 1
  • 1
    welcome to stackoverflow. what have you ***tried yourself*** so far? what problems did you encounter? what have you researched? i recommend [taking the tour](https://stackoverflow.com/tour), as well as reading [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and [what's on topic](https://stackoverflow.com/help/on-topic). – Franz Gleichmann May 26 '21 at 15:10

1 Answers1

0

Xaml code

<xceed:ColorPicker x:Name="MyNiceColorPicker"/>
<Button x:Name="MyNiceButton" Click="MyNiceButton_Click"/>

And C#

private void MyNiceButton_Click(object sender, RoutedEventArgs e)
{
    MyNiceButton.Background = new SolidColorBrush(MyNiceColorPicker.SelectedColor ?? (MyNiceButton.Background as SolidColorBrush).Color);
}
Jacob Shanley
  • 893
  • 1
  • 8
  • 19
Victor V.
  • 36
  • 3