Foreground and Background properties are of Brush type. How to get Color for further usage in Color Picker?
I pass Foreground and Background to c-tor of a properties window like this:
private void Menu_Properties_OnClick(object sender, RoutedEventArgs e)
{
PropertiesDialog propDialog = new PropertiesDialog(TbTimer.Foreground, TimerPanel.Background);
if (propDialog.ShowDialog() == true)
{
//set color to TbTimer textbox and TimerPanel WrapPanel
}
}
TbTimer
is TextBox, TimerPanel
is WrapPanel.
This is properties window c-tor:
public PropertiesDialog(Brush foreground, Brush background)
{
InitializeComponent();
FontColorPicker.SelectedColor = foreground; //Compilation error
BgColorPicker.SelectedColor = background; //Compilation error
}
Here I get Cannot implicitly convert type 'System.Windows.Media.Brush' to 'System.Windows.Media.Color'
.
How to get brushes color?