3
votes

I'm having some issues with resource files in my modular application.

I have Infrastructure.DLL and some custom controls inside this DLL. Those controls using templates from themes/generic.xaml Issue that I have - Blend doesn't recognize those resources. Visual studio does.

Ideally I'd like to have styles for my cusom controls inside generic.xaml and styles for other controls somewhere else in common library that I can reference from my modules.

I also need Expression Blend and VS to work properly.

How do I arrange solution to make it happen?

PS. Important! WPF is different but I'm interested in Silverlight solution

1
Did you mean Themes\Generic.xaml ?AnthonyWJones
Yes, this is what I meant. I fuxed postkatit

1 Answers

4
votes

You just need to create design time resource for your generic.xaml in order to let Blend recoganize it. Take a look at this post.

In each of your modules, you create a ResourceDictionary like this.

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
        <ResourceDictionary.MergedDictionaries>
Source="/xxx.Silverlight.Controls;component/Themes/Generic.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>

Also, in your .csproj file, you need to add this. Please note that normally this piece of code is auto-generated by Blend, so if your ResourceDictionary is auto-generated, you don't need to do the following.

<Page Include="Design\DesignTimeResources.xaml" Condition="'$(DesignTime)'=='true' OR ('$(SolutionPath)'!='' AND Exists('$(SolutionPath)') AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true')">
  <Generator>MSBuild:Compile</Generator>
  <SubType>Designer</SubType>
  <ContainsDesignTimeResources>true</ContainsDesignTimeResources>
</Page>

Design is the folder I created for storing my DesignTimeResources.xaml. I pretty much have the same structure as yours. :)