How can I fix "An error occurred while finding the resource dictionary " due to ListPicker styling

1k views Asked by At

I have several resource dictionaries located in same place, but one of them gives me an error (style.xaml) and I can't figure out how to solve it.

An error occurred while finding the resource dictionary "/MyApp.WindowsPhone;component/Resources/Style.xaml".    MyApp-WP C:\Users\MyApp\developers\apps\MyApp-WP\MyApp-WP\App.xaml 19  

My App.xaml looks like:

        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/MyApp.WindowsPhone;component/Resources/Colors.xaml" />
            <ResourceDictionary Source="/MyApp.WindowsPhone;component/Resources/Dimens.xaml" />
            <ResourceDictionary Source="/MyApp.WindowsPhone;component/Resources/Style.xaml" />
            <!--<ResourceDictionary Source="pack://application:,,,/MyApp.WindowsPhone;component/Style.xaml" />-->
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>

where

<ResourceDictionary Source="/MyApp.WindowsPhone;component/Resources/Style.xaml" />

is the one it can't find.

The only difference (except the styles in them) are the headers:

Style.xaml

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:MyApp.WindowsPhone.UI.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit">

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/MyApp.WindowsPhone;component/Resources/Dimens.xaml" />
    <ResourceDictionary Source="/MyApp.WindowsPhone;component/Resources/Colors.xaml" />
</ResourceDictionary.MergedDictionaries>

and in Dimens.xaml:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Thickness x:Key="MyAppBorderThickness">1</Thickness>
    <CornerRadius x:Key="MyAppCornerRadius">3</CornerRadius>
</ResourceDictionary>

I've tried using the pack: as you can see from the commented line above, that didn't work either. I've tried and changed the Content from Page to other things, nothing helped. Cleaned out everything (bin, obj), restarted VS2015 and so on... Nothing. The styles works perfectly in runtime, but it's really annoying that I can't see how it looks like in design time!

Anyone has any idea what I'm missing?

EDIT:

Well, after splitting up the resources in many different files I narrowed it down to:

ItemTemplate="{TemplateBinding ActualFullModeItemTemplate}" 

which I'm using in:

<Style TargetType="toolkit:ListPicker

Do I somehow need to add the styles from toolkit listpicker in my app?

0

There are 0 answers