1

我有几个要在项目之间共享的图像文件(常用图标) 我将它们放在一个程序集中,该程序集将出现在我创建的每个解决方案中...我将文件放在一个名为 Icon 的文件夹中,并且始终将构建作为内容副本. 我已验证使用这些图标创建了一个文件夹...但是我的其他程序集无法找到它们...

<r:RibbonGroup Header="Users">
    <r:RibbonButton >
       <r:RibbonButton.LargeImageSource>
            <BitmapImage UriSource="..\Icons\UserIcon.png" />
       </r:RibbonButton.LargeImageSource>
    </r:RibbonButton>
</r:RibbonGroup>

我尝试了几种格式化uri的方法......但它从未成功。如果图标在实际程序集中,尽管它们可以工作......

4

1 回答 1

5

尝试使用绝对 Uri。构建操作必须设置为 UserIcon.png 的资源

<BitmapImage UriSource="pack://application:,,,/NameOfImageAssembly;component/Icons/UserIcon.png"/>

相对 Uri 也应该有效

<BitmapImage UriSource="/NameOfImageAssembly;component/Icons/UserIcon.png"/>
于 2010-12-18T00:07:39.853 回答