tags:

views:

181

answers:

1

I have code looks like below:

ResourceDictionary res = (ResourceDictionary)Application.LoadComponent(new Uri("Style.xaml", UriKind.Relative));
Style style = new Style();
style.Resources = (Style)res["ComboBoxTextBox"];

VS2008 retuns error:

style.Resources = (Style)res["ComboBoxTextBox"];

Cannot implicitly convert type 'System.Windows.Style' to 'System.Windows.ResourceDictionary'

How i can properly assign a style from ResourceDictionary to control?

A: 

it should be as easy as

myControl.Style = (Style)res["ComboBoxTextBox"];

jarek
Ah yes, I've just made a simple mistake :) Too hard work today :D Thx for help
Kamilos