0

I have separated libraries for my applications and I want to put ResourceDictionary to keep my default styles in one place.

In my project mylib that is build to mylib.dll i have Styles/General.xaml:

<ResourceDictionary
x:Class="gjdapi.Style.General"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib">

I'm referencing it in my App.xaml:

<Application.Resources>
    <ResourceDictionary x:Key="General">
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/mylib;component/Styles/General.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

Build for Styles/General.xaml is set to Page.

I found some tips here:

Use an External ResourceDictionary in a WindowsPhone 7 app

xClassNotDerivedFromElement error when adding Code Behind to Resource Dictionary in silverlight

Error using ResourceDictionary in Silverlight

but nothing seems to work i always hit this exception:

Message "Parser internal error: Object writer 'xClassNotDerivedFromElement'. [Line: 15 Position: 32]"   string

Please tell me what am I missing?

Community
  • 1
  • 1
Wojciech Sobczyk
  • 343
  • 3
  • 12

1 Answers1

0

As lisp suggested ResourceDictionary can't have code behind so line x:Class="gjdapi.Style.General" should be removed

Wojciech Sobczyk
  • 343
  • 3
  • 12