WPF ResourceDictionary and DynamicResource?

Up vote 1 down vote favorite share g+ share fb share tw.

I am new to WPF so maybe this will be "noob" question but I can't find answer to it (and it seems so easy)... well I am programing WPF app and I want to use smth similar to css for webpages, so I found ResourceDictionary and tried to use it... I have main window in which I create Frame and on click some UserControl is loaded to that same Frame. I include my ResourceDictionary (root/style/Styles. Xaml) to my main window like this: in which I have: ... I don't use it on my main window but want to use it on my UserControls, which are loaded to that main window and I try to use it like this: Warning I am getting all the time is: The resource "ProductsRequired" could not be resolved.

I even tried including Styles to my UserControl and nothing happens... Well my question is long but I wanted to be clear... :) P.S. all that logic works in C# code btw private ResourceDictionary myStyles = new ResourceDictionary(); Style ProductsRequired = myStyles"ProductsRequired" as Style; product1. Style = ProductsRequired; wpf xaml resourcedictionary link|improve this question edited Dec 14 '11 at 0:59Remo Gloor12.8k2838 asked Dec 13 '11 at 22:50lanicor82.

I did that before and it didn't work like it doesn't now... :( I don't know what I am doing wrong... And I cant use other resources if I use that... – lanicor Dec 14 '11 at 17:10.

This won't do, you add a resurce dictionary as a resource when you need to add it to the resources, it cannot be accessed like this. You need to add it to the MergedDictionaries (See MSDN for usage examples! ).

Ok thanx I will check it out... – lanicor Dec 13 '11 at 22:59.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions