I have a WPF project, I want to set its background color dynamically, this is my XAML code
<Window.Resources>
<SolidColorBrush x:Key="TextBoxBorderColor" Color="#FFB4A5B4"/>
<SolidColorBrush x:Key="TextBoxForegroundColor" Color="Black"/>
<SolidColorBrush x:Key="TextBoxBackgroundColor" Color="White"/>
</Window.Resources>
<ComboBox x:Name="cmbUserFullName" Background="{DynamicResource TextBoxBackgroundColor}" Foreground="{DynamicResource TextBoxForegroundColor}"
BorderBrush="{DynamicResource TextBoxBorderColor}">
</ComboBox>
And this is my code behind
var brush7 = FindResource("TextBoxBackgroundColor") as SolidColorBrush;
if (!string.IsNullOrEmpty(Default.clrPckerTextBoxBackground)) brush7.Color = (Color)ColorConverter.ConvertFromString(Default.clrPckerTextBoxBackground);
var brush8 = FindResource("TextBoxForegroundColor") as SolidColorBrush;
if (!string.IsNullOrEmpty(Default.clrPckerTextBoxForeground)) brush8.Color = (Color)ColorConverter.ConvertFromString(Default.clrPckerTextBoxForeground);
var brush9 = FindResource("TextBoxBorderColor") as SolidColorBrush;
if (!string.IsNullOrEmpty(Default.clrPckerTextBoxBorder)) brush9.Color = (Color)ColorConverter.ConvertFromString(Default.clrPckerTextBoxBorder);
But it makes no change in combo box background color and border brush color. Can anybody help me know where is wrong with my codes? Thanks...