Click here to Skip to main content
15,918,889 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have defined a simple style for all buttons in my project in a resource dictionary. I'm referencing the dictionary in the App.xaml file. If I run the project everything works fine, but at design time there is an error inside the App.xaml file "An error occurred while finding the resource dictionary "Dictionary1.xaml". Why is it not resolving at designtime and prevents me from seeing design changes untill I run the project.

Here is the code in my Resource Dictionary

C#
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ctMyButton">

    <Style TargetType="Button">
        <Setter Property="MinWidth" Value="50"/>
        <Setter Property="MinHeight" Value="23"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Ellipse Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Fill="{TemplateBinding Background}"/>
                        <TextBlock Text="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></TextBlock>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>


And here is the App.xaml code
C#
<Application x:Class="ctMyButton.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:ctMyButton"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Dictionary1.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>


What I have tried:

I have tried researching the problem but there are no answers for this exact question and any walk through just assume the dictionary is resolving.
Posted
Updated 2-Mar-16 21:48pm

1 solution

In this link you can find answer
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900