Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 55649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:24:38+00:00 2026-05-10T17:24:38+00:00

When using resources such as brushes, templates and styles in WPF, they can be

  • 0

When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources

<Rectangle Fill='{StaticResource MyBrush}' /> 

or as a DynamicResource

<ItemsControl ItemTemplate='{DynamicResource MyItemTemplate}'  /> 

Most of the times (always?), only one works and the other will throw exception during runtime. But I’d like to know why:

  • What is the main difference. Like memory or performance implications
  • Are there rules in WPF like ‘brushes are always static’ and ‘templates are always dynamic’ etc.?

I assume the choice between Static vs Dynamic isn’t as arbitrary as it seems… but I fail to see the pattern.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:24:38+00:00Added an answer on May 10, 2026 at 5:24 pm

    A StaticResource will be resolved and assigned to the property during the loading of the XAML which occurs before the application is actually run. It will only be assigned once and any changes to resource dictionary ignored.

    A DynamicResource assigns an Expression object to the property during loading but does not actually lookup the resource until runtime when the Expression object is asked for the value. This defers looking up the resource until it is needed at runtime. A good example would be a forward reference to a resource defined later on in the XAML. Another example is a resource that will not even exist until runtime. It will update the target if the source resource dictionary is changed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I link to resources such as css and javascript files? My default
I'm using Microsoft's idea for storing resource and booking information. In short, resources, such
What is the benefit of referencing resources using globally-unique URIs (as REST does) versus
We are preparing to develop an enterprise Human Resources Project using ASP.NET and our
What are some good jQuery Resources along with some gotchas when using it with
Do you know of any resources that describe building a data access layer using
How do you load program resources such as icons, strings, graphical elements, scripts, and
I've come across a strange behaviour in Visual Studio 2010. When using embedded resources
I'm working with JSF and XHTML templates , I'm using a CSS file in
A web-bot crawling your site and using bandwdith resources. Bots are numerous and for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.