开发者

accessing image files from a separated assembly

I have several image files I want to share between projects(common icons) I have them in an assembly that would be in every solution I create...I have t开发者_StackOverflow中文版he files in a folder called Icon and I have the build as content copy always. I have verified that a folder is created with these icons...however my other assemblies are not able to find them...

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

i have tried formatting the uri several ways...but it never succeeds. If the icons are in the actual assembly though they work...


Try using an absolute Uri. Build action must be set to Resource for UserIcon.png

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

Relative Uri should also work

<BitmapImage UriSource="/NameOfImageAssembly;component/Icons/UserIcon.png"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜