3
Reply

What is difference between DynamicResource property and StaticResource Property in WPF?

Amar Singh

Amar Singh

Sep 18, 2012
2k
0

    DynamicResource occur run timeStaticResource are static

    Shailesh Uke
    May 06, 2015
    0

    http://stackoverflow.com/questions/200839/whats-the-difference-between-staticresource-and-dynamicresource-in-wpf

    Munesh Sharma
    April 23, 2014
    0

    from c-sharpcorner site:Resources provide a simple way to reuse commonly defined objects and values. If we are defining the resource then we can use that resource a number of times. (Just like applying themes and css to web pages). Resources are two types:1. Static Resource2. Dynamic Resource.StaticResource: StaticResources are resolved at compile time. Use StaticResources when it's clear that you don't need your resource re-evaluated when fetching it static resources perform better than dynamic resources.DynamicResource: DynamicResources are resolved at runtime. Use DynamicResources when the value of the resource could change during the lifetime of the Application.I will show you an example of a Static Resource.In my WPF application page I have one textbox and two ellipses. In Window.Resources I defined the SolidColorBrush and the Style properties. In above code you can observe x: Key attribute. x: Key uniquely identifies elements that are created and referenced in a XAML-defined dictionary.Here I'm using above resources. Have a look at below code. Syntax is :{ StaticResource x:keyName} Result window looks like this.

    Nagi Setty A
    June 08, 2013
    0