I am new to WPF and i need to learn the static resource and dynamic resource. i have tried to set the style for button using the Dynamic Resource and change the style using button Click but the style is not changed. please refer my code i used for change the button style using click
Codes :
Click :
private void Content_Click(object sender, RoutedEventArgs e)
{
this.Resources.Add("Style1", new SolidColorBrush(Colors.Blue));
}
Could you please any one guide me how to achieve my requirement.

ali tuncerRank #1,499 · 1.1K reputationPosted Mar 10, 2016, 6:55 PM EST
try this :
Click :
private void Content_Click(object sender, RoutedEventArgs e)
{
Resources["Color"] = new SolidColorBrush(Colors.Blue);
}
Suthahar JegatheesanRank #162 · 14.5K reputationPosted Sep 29, 2021, 10:50 PM EDT
Buttonstylewith the newstyle: