2

I have a simple style in a resource dictionary which is located in a WPFResources.dll, I am accessing this style in another project, I can see that the style is being applied at design time, but when i run the application I am getting an exception that "Cannot find resource named 'IndentCheckBoxStyle'. Resource names are case sensitive". if i use the StaticResource then I can see this exception if I use the DynamicResource then I dont see any exception, but nothing is visible on the UI.

More about this issue:

I have referenced the WPFResources.dll in my project and merged it in the App.XAML like this:

<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/WPFResources;component/Theme.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> 

And inside the Theme.xaml i have merged the resource dictionary of the cheboxstyle.

Any one have any idea about this ??

Thanks in advance.

5
  • How about you post the related code? Commented May 22, 2013 at 10:18
  • Is WPFResources.dll available in the application bin path? Commented May 22, 2013 at 10:27
  • Yes it is in Bind folder and i have added in the App.XAML Commented May 23, 2013 at 3:10
  • 5
    If you solved your problem then please post the answer, I have the same problem and now I have no idea how you solved it. Commented Aug 19, 2013 at 1:26
  • I have missed some of brush resources which are referenced by the IndentCheckboxStyle inside the WPFResources.dll. Commented Aug 19, 2013 at 9:22

1 Answer 1

1

I've had this problem and found that the styles were being applied to the entire application using the Pack URI syntax,

e.g. in App.xaml

<Application x:Class="Framework.Presentation.Preview.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/Abt.Framework.Presentation;component/Themes/AbtDark.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> 

However, an implicit style is not being applied to the top level window in the application (despite MyTheme.xaml containing an unnamed Style for Window)

To resolve this, I've simply used a named style (not implicit style) for the Window. The rest are applying correctly.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.