pack://application:,,,/ResourceFile.xaml Never Works

前端 未结 2 2041
甜味超标
甜味超标 2021-02-09 08:19

I have never been able to get this format of reference a Resource Dictionary to work. What am I missing.

Scenario:

Creating and assembly with some usercontrols i

相关标签:
2条回答
  • 2021-02-09 08:29

    Can't reproduce your problem. All these variations work fine:

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Themes/ColorThemes.xaml"/>
        <ResourceDictionary Source="/Themes/ColorThemes.xaml"/>
        <ResourceDictionary Source="../../Themes/ColorThemes.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    

    Note that pack://application:,,, is optional and / refers to the root of the current assembly.

    Please provide complete minimal example which reproduces your problem.

    0 讨论(0)
  • 2021-02-09 08:48

    try:

    pack://application:,,,/YOURNAMESPACEHERE/ColorThemes.xaml
    

    E.g.

    pack://application:,,,/Themes/ColorThemes.xaml
    
    0 讨论(0)
提交回复
热议问题