Reputation: 2113
Can't figure out why in runtime image on button is not visible. At the same time in design mode it looks fine.
Also tried to remove Stretch, set Height and Width for image, change image to jpg/png, change Source to "ProjectName,component"
Upvotes: 0
Views: 2249
Reputation: 2113
When images were added to project resources Visual Studio set Build Action to None for such files...
Build Action
to Resource
/Resources/filename.png
Stretch
for imageSee working snippet
<Button x:Name="BtName" Click="Bt_Click" Height="35" Width="35">
<Image Source="/Resources/Button-Turn-Off-icon.png" Stretch="Fill" />
</Button>
Upvotes: 1
Reputation: 9857
You need to set the Build Action to Resource, set always copy and add the image to the bin\debug (and release if you are using it) files. Some times VS doesn't bring it in and I don't know why but I had the same problem recently.
Upvotes: 0