I came across a similar problem. I was using the following format initially (under a class library project).
<Image Source="pack://siteoforigin:,,,/Images/Toolbars/Legend.png"/>
However, when I would Clean/Build or Rebuild the solution or restart the Visual Studio, the button image would disappear, even though I would see them on XAML designer.
I came up with a weird solution but it worked for me.
With this solution the images always remain in tact during runtime and on the XAML at design time,
-After solution is rebuild
-After solution is cleaned and build
-After the Visual Studio is closed and restarted.
This solution requires to have 2 folders (I called Resources) with same image names, both under the Main Application and the class library project. Under the project
<Image Source="pack://application:,,,/Resources/Legend.png"/>
For the images set BuildAction = Resource & Copy to OutputDirectory = Do not copy in both places.
If I use only the Resource Folder at the main application, it still works but this time the XAML design time Parser cannot see the image. That is why I have duplicated the same folder at the class library (where the XAML UserControl is located).
The reason for this complication may be XAML Parser inner workings. The Design Time portion of it looks always at folder location under the project where the UserControl is located, while the runtime portion of it requires the images to be in the main application to run properly.
I am not claiming that this is the proper solution or a reasonable solution at all, but it worked in my case. Comments for an improved or better solution is welcomed.
UPDATE: After trial and error + some other clues (https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/aa970069(v=vs.100)), I came up with a simpler solution and it works (for me)
At Resources declare:
<BitmapImage x:Key="mLegend" UriSource="pack://siteoforigin:,,,/Images/Toolbars/Legend/Legend.png"/>
under Button declare:
<Image Source="{StaticResource mLegend}"/>
set BuildAction = Content & Copy to OutputDirectory = Copy if new
As final step, Clean and Build solution.