views:

143

answers:

2

Hello,

I am trying to create an ResourceFile Called DataTemplate.xaml in an external dll and use that in a WP7 page. When I do the following in the header of my Page I get an error

<ResourceDictionary Source="pack://application:,,,/WP7SharedClassLibrary;component/DataTemplate.xaml" />

The error is "Current project does not support 'application' as the authority component of the pack URI."

Has anyone else come across this and solved this?

A: 

I tried the pack syntax while trying to share XAML ResourceDictionary files and got the same error message. I ended up using this syntax and it worked for me.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/MyDLLName;component/Folder/MyXAMLFile.xaml"/>                
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>
Rich Reuter
A: 

Silverlight doesn't support pack URIs. It's a WPF feature.

If you examine the type of the Source property for the Image object in Silverlight it is Uri. But in WPF the source is a dependency property with a type of ImageSource.

Simon Brangwin