0
votes

In my solution, I have one application project, which defines all the resources - like brushes and styles. I want to access these resources in views of other projects, which are Prism modules and they get resolved at run time.

For example, I have the following defined in my Silverlight application's App.xaml:

<LinearGradientBrush x:Key="MyBrush" EndPoint="0.5,1" StartPoint="0.5,0">
  <GradientStop Color="#FFFFA700" Offset="0.482" />
  <GradientStop Color="#FFFF7600" Offset="0.864" />
  <GradientStop Color="#FFFFB400" Offset="0.169" />
</LinearGradientBrush>

Now, I want to use this brush in one of the Prism modules like this:

<Border Background="{StaticResource MyBrush}"/>

Note that the modules are resolved using XAML Module Catalog. The above line is marked as error in the designer, although it gets properly resolved at runtime.

What would be the best way to define resources in a silverlight modular application so that they can be accessed in all the modules without the designer errors?

4

4 Answers

0
votes

I just tried your code and it works for me, what else do you have in the prism control?

0
votes

Well, finally I had to move all the resources to another assembly and refer that assembly in each module.

0
votes

Here is another solution using conditional building: Using Blend with Prism Apps in Silverlight

0
votes

Prism will take care of this for you. Just reference the Microsoft.Practices.Unity.Silverlight assembly in your module projects. This provides the design-time magic to find resources defined in your shell project.