DynamicResource is a XAML mechanism allowing the resources to be resolved during application runtime. It also allows changing the resources in such way, that each user of these resources will be notified and allowed to react accordingly to the change.
Questions tagged [dynamicresource]
134 questions
22
votes
1 answer
How can you bind to a DynamicResource so you can use a Converter or StringFormat, etc.? (Revision 4)
Note: This is a revision of an earlier design that had the limitation of not being usable in a style, negating its effectiveness quite a bit. However, this new version now works with styles, essentially letting you use it anywhere you can use a…

Mark A. Donohoe
- 28,442
- 25
- 137
- 286
19
votes
4 answers
Use IValueConverter with DynamicResource?
Is there a way to define a converter when using the DynamicResource extension? Something in the lines of
which…

bitbonk
- 48,890
- 37
- 186
- 278
17
votes
3 answers
Is there a significant performance cost to DynamicResource instead of StaticResource?
Our designer is using Blend to style our WPF application. When he chooses local resources for properties, Blend will apply them as a {DynamicResource} instead of a {StaticResource}. My guess is that Blend does this because it enables the app to be…

scobi
- 14,252
- 13
- 80
- 114
17
votes
4 answers
Binding to resource key, WPF
I have a ResourceDictionary with some images:
I've create a HierarchicalTemplate for treeview items like the following:

Spook
- 25,318
- 18
- 90
- 167
12
votes
1 answer
WPF Dynamic Resource: Warning Message - "The resource 'resource' could not be resolved."
Basically, I have a UserControl that uses a DynamicResources. The application compiles and runs fine using that resource, but it's a bit annoying to see this warning message. It makes me wonder if I'm doing it right and it's just a false positive,…

myermian
- 31,823
- 24
- 123
- 215
12
votes
2 answers
How to bind with dynamic resource and specifying a path
I want to bind to a resource (DynamicResource) and access properties on that resource, but is there a way to do that?
(I want to visualize the default values from constructor in the xaml editor in visual studio. Those cannot be seen when…

erikH
- 2,286
- 1
- 17
- 19
12
votes
5 answers
DynamicResource color doesn't work for BorderBrush on a Border - Bug?
Visual Studio 2010 | .NET/WPF 4.0
I think this might be a WPF bug, but I can't seem to find a bug report about it. To cover the possibility that I'm just missing something obvious, I turn to stackoverflow for answers!
Consider this xaml (nothing in…

pfw
- 237
- 3
- 9
11
votes
3 answers
Place storyboard in application resources
I need to use the same storyboard in several places therefore I placed the storyboard inside my Application.Resources . When I try to execute the storyboard the only problem is that I need to reference the target that I want to animate. Here is my…

Tono Nam
- 34,064
- 78
- 298
- 470
11
votes
3 answers
WPF StaticResource works, DynamicResource doesn't
I have been trying for a day now, to no avail, to create a bunch of brushes in the theme then using them with DynamicResource in a custom control. What I did is this:
create the theme generic.xaml which contains styles (works)
add a dictionary to…

Siderite
- 181
- 1
- 5
10
votes
2 answers
Return a dynamic resource from a converter
I want to change the color of a WPF control depending on the state of a bool, in this case the state of a checkbox.
This works fine as long as I'm working with StaticResources:
My control

lewi
- 477
- 1
- 5
- 18
10
votes
2 answers
WPF Dynamic resource example
Is there any example which can clearly state the difference between Static and dynamic resource. I know the basic difference that Static is loaded once and gets binded at start while dynamic is loaded at run time and rebinded every time the control…

Ankit
- 6,388
- 8
- 54
- 79
8
votes
2 answers
WPF: Dynamic MarkupExtension- ReRendering/Updating of value
I´m using a markupextension for loading internationalized strings in a WPF application like this:
My markupextension is named "TranslateExtension" and it searches a value for the key "MyText" from a database.…
JanLookingForClues
7
votes
4 answers
Wpf Toolkit. Bind DataGrid Column Header to DynamicResource
I'm trying to bind DataColumn Header to DynamicResource using following code.
Header Text
…

Oleg
- 1,100
- 2
- 11
- 16
6
votes
1 answer
How to bind a string to a dynamic resource through code in WPF
I am currently working on a project where I use Caliburn to bind between View and ViewModel. In order to be able to switch between languages during runtime, I have separate resource files containing all the strings used in the application. Some of…

Tallang
- 143
- 2
- 7
6
votes
1 answer
Why don't MenuItems work with DynamicResource?
The main menu of my program uses a ContextMenu composed of MenuItems. During the localization of my program (using Resource Dictionaries), I set a DynamicResource as the Header of each one of my MenuItems. Strangely DynamicResource compiles, but…

Eric after dark
- 1,768
- 4
- 31
- 79