0

I have a RibbonSplitButton that contains a SmallImageSource like so:

<UserControl x:Class="myProgram/toolbars/MainToolbar">
    <RibbonSplitButton SmallImageSource="/Images/Undo.png"/>
    <!-- more buttons-->
</UserControl>

I try to use this in another file (main):

<UserControl x:Class="myProgram/main"
             xmlns:toolbar="clr-namespace:myProgram.toolbars">
    <toolbar:MainToolbar/>
</UserControl>

I get the error message in main:

Cannot locate resource 'images/undo.png'

However, when I switch to a normal button:

<Button>
    <Image Style="{StaticResource buttonstyle}">
        <Image.Source>
            <BitmapImage DecodePixelWidth="40" UriSource="/Images/Undo.png"/>
        </Image.Source>
    </Image>
</Button>

the error is gone. I have tried using Pack URIs, changing the Build Action to Resource and Embedded Resource, as well as Clean Soultion, Rebuild Solution, Restarting Visual Studios (rinse and repeat). I image this has something to do with the RibbonSplitButton's image source, but I have no idea. The program runs fine (the Undo.png image shows and works perfectly), it's just annoying to have the error in my developer. Anyone have suggests on how to get rid of the error? (Note, this is a simplified folder structure, for example purposes).

EDIT
For anyone who ends up here at some point in the future, I found that this answer worked.

eye_am_groot
  • 682
  • 6
  • 19
  • I have tried creating a project and using `` and it works fine for me. The build action on the file is Resource. – Ove Aug 03 '18 at 11:27
  • Sorry, @Ove, I forgot to mention the error is in another file. I have updated my question to represent the error better. – eye_am_groot Aug 03 '18 at 11:36

0 Answers0