我的代码如下所示:
ResourceDictionary res = (ResourceDictionary)Application.LoadComponent(new Uri("Style.xaml", UriKind.Relative));
Style style = new Style();
style.Resources = (Style)res["ComboBoxTextBox"];
Run Code Online (Sandbox Code Playgroud)
VS2008返回错误:
style.Resources = ( Style )res["ComboBoxTextBox"];
Cannot implicitly convert type 'System.Windows.Style' to 'System.Windows.ResourceDictionary'
Run Code Online (Sandbox Code Playgroud)
如何正确分配控件的样式ResourceDictionary
?