none
WPF pack uri not working

    Question

  • Although I've found a lot of "pack uri issue" questions, I didn't get an answer for my problem.

    I have a prism solution where I want a MyApplication.Resources assembly hold all my application wide styles and templates.

    So

    • step 1: I've created the solution (WpfUsercontrollibrary)
    • step 2: folder /Themes was created
    • step 3: Generic.Ribbon.xaml was created
    • step 4: Generic.xaml was created
    • step 5: Generic.xaml has a MergedDictionary part to merge all the Generic.xxx.xaml files
    • step 6: MyApplication.Resources assembly referenced in prism module assembly
    • step 7: loading the Generic.xaml in my module view (type: Microsoft.Windows.Controls.Ribbon.RibbonTab

     <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/MyApplication.Resources;component/Themes/Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    I've also tried the absolute variant with

    <ResourceDictionary Source="pack://application:,,,/ElairoCRM.Resources;component/Themes/Generic.xaml"/>

    All steps above are verified with the MSDN doku to pack uri and a lot of forum questions and wpf resource tutorials in the internet.

    But nothing works. Did I miss something?

    Thank you in advance.


    //edit: I've forgot the error that occured:

    XamlParseException with inner exception FileNotFoundException having the message: The file or assembly \"MyApplication.Resources, culture=neutral" or one of its dependencies, was not found.


    • Edited by csteinmueller Wednesday, May 23, 2012 11:56 AM content added
    Wednesday, May 23, 2012 10:56 AM

Answers

  • I've resolved the problem by myself. I copied the Generic.xaml file in the Resource assembly from the themes folder to the assembly root and changed the pack argument to component/Generic.xaml. Everything works now as expected. I've found no documentation about this behaviour.
    • Marked as answer by csteinmueller Wednesday, May 23, 2012 12:09 PM
    Wednesday, May 23, 2012 12:09 PM

All replies

  • I've resolved the problem by myself. I copied the Generic.xaml file in the Resource assembly from the themes folder to the assembly root and changed the pack argument to component/Generic.xaml. Everything works now as expected. I've found no documentation about this behaviour.
    • Marked as answer by csteinmueller Wednesday, May 23, 2012 12:09 PM
    Wednesday, May 23, 2012 12:09 PM
  • Thank you for your sharing, csteinumeller.

    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us

    Monday, May 28, 2012 3:56 AM
    Moderator