I have to create a color picker in my WPF application. When I click on any color, the code of that color should come in a textbox. I googled a lot but found nothing matching
The easiest way is to use ColorDialog which were used in WinForms.
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
DrawBallColorBtn.Background = new SolidColorBrush(Color.FromArgb(colorDialog.Color.A, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B));
_drawBallColor = colorDialog.Color.Name.ToLower();
}
If you are targeting to a .NetCore 3.x add the fallowing to the .csproj file
netcoreapp3.0
true
true