Sanwar Ranwa
Explain the difference between static and dynamic resource in WPF.
By Sanwar Ranwa in WPF on Feb 12 2018
  • Bhagawat Shinde
    Jun, 2019 25

    1. Static Resource - Static resources are the resources which you cannot manipulate at runtime. The static resources are evaluated only once by the element which refers them during the loading of XAML.2. Dynamic Resource - Dynamic resources are the resources which you can manipulate at runtime and are evaluated at runtime. If your code behind changes the resource, the elements referring resources as dynamic resources will also change.For example, if you use "bitmapImageResource" as a static resource, it will not change even if you manipulate the images source at runtime.However let us say, if you are referring "textForeColorResource" as a dynamic resource and if your code behind logic changes the color at runtime, the elements which are referring this resource will get affected.

    • 1

Most Popular Job Functions