Static Resource Vs Dynamic Resource in XAML

Difference between Static Resource and Dynamic Resource

Look at Table:

Static Resource Dynamic Resource
Syntax:
<object property="{StaticResource key}" .../>
<object>
<object.property>
<StaticResource ResourceKey="key" .../>
</object.property>
</object>
Syntax:
<object property="{DynamicResource key}" .../>
<object>
<object.property>
<DynamicResource ResourceKey="key" .../> </object.property>
</object>
It Assign the property in the while between Compilation and Application runs. So all values are resolved before the application runs It may called as On Demand Resource because it actually loads the object but value that is wait until the object need while the runtime
It will assign once at the compile time, So the value changes done after the runtime can be ignored It will assign the vale whenever the object demand for the same
It uses the same value up to entire lifetime of the application It will refer the value whenever it requires, May be refreshed
It is very optimal to use whenever the value may not be changed like, Brushes, Font e.t.c It is very optimal way to use whenever we change the value by code behind.
It will not refer any other parent’s resources, So it fail to use in UserControl Here it will assign the resource to any other control, So it referred in UserControl from its hosted Parent
While using Complex Object, It take more time to load the application It quickly loads even we used heavy resource object.
Next Recommended Reading Adding Images to Resource in WPF