When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources
I was also confused about them. See this example below:
Here I have used dynamic resource for button and window and have not declared it anywhere.Upon runtime, the ResourceDictionary of the hierarchy will be checked.Since I have not defined it, I guess the default will be used.
If I add the code below to click event of Button, since they use DynamicResource, the background will be updated accordingly.
private void ButtonNew_Click(object sender, RoutedEventArgs e)
{
this.Resources.Add( "PinkBrush"
,new SolidColorBrush(SystemColors.DesktopColor)
);
}
If they had used StaticResource:
Hope I cleared some confusion.