0

I'm currently working on a personnal library (toolkit) to help me during my other projects. Inside I have all my xaml style and some functions that I often use.

when I create a new application, I add my "toolkit" in the references and I add it in my app.xaml file like that :

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/ToolKit;component/styles/global.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

With that, everything is working. I just got the following error "an error occurred while finding the resourcedictionary" but when I run it my styles are good.

But when I need to create a second custom library (to integrate it in revit) I don't have any success... I tried this link but nothing is working. I get the same error "an error occurred while finding the resourcedictionary" and when I run it I don't have my styles...

I call the styles like that :

Style="{DynamicResource Borderless}"

and I got the error "the ressource Borderless could not be resolve"

My Toolkit have the namespace "ToolKit", a folder "Styles" and all the xaml inside this folder with a "Global.xaml" that merge all the dictionaries.

How can I get my styles applied ?

thank you

Edit :

Here is the DesignTimeResources.xaml to call the style :

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/ToolKit;component/Styles/Global.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

and the Global.xaml look like this :

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ToolKit.Styles">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Windows.xaml" />
        <ResourceDictionary Source="Borders.xaml" />
        <ResourceDictionary Source="Buttons.xaml" />
        <ResourceDictionary Source="CheckBox.xaml" />
        <ResourceDictionary Source="Label.xaml" />
        <ResourceDictionary Source="ListView.xaml" />
        <ResourceDictionary Source="RadioButton.xaml" />
        <ResourceDictionary Source="RichTextBox.xaml" />
        <ResourceDictionary Source="ScrollBar.xaml" />
        <ResourceDictionary Source="TextBlock.xaml" />
        <ResourceDictionary Source="TextBox.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Thibaud
  • 377
  • 1
  • 2
  • 15
  • @mm8 I added the reference in my new project. and the XAML code that fail is the call of the styles in my new project. – Thibaud Oct 20 '17 at 12:09
  • "Borderless" is defined in global.xaml? And you try to apply the style to an element in your application? So there is one application and one external assembly involved? – mm8 Oct 20 '17 at 12:14
  • Yes it what I tried to explain. (Sorry for my bad english...). here is two case, one with an Application + Ext. Assembly (Working) and a second case with an Assembly + Ext. Assembly (not working) – Thibaud Oct 20 '17 at 12:38
  • @mm8 I added both code (Gloabl.xaml and DesignTimeResources.xaml) the DesignTimeResources.xaml file is instead of the app.xaml. – Thibaud Oct 20 '17 at 13:46
  • sorry, copy past :/ it's toolkit – Thibaud Oct 20 '17 at 14:11
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/157144/discussion-between-thibaud-and-mm8). – Thibaud Oct 20 '17 at 14:19

0 Answers0