Search code examples
c#wpfmvvmcaliburn.microstackpanel

Stackpanel in a button


I'm supposed to make a user-control using WPF, and now i'm bumping into a weird problem.

I came up with a kinda weird solution to get an image along with some text in a button, like this:

<Button Height="24" Width="100" Name="btn_change">
     <StackPanel Width="90">
           <Image Source="Images\11.png" Width="24" Height="18" HorizontalAlignment="Left" Panel.ZIndex="-1" Stretch="Uniform"></Image>
           <Label Content="Change" HorizontalAlignment="Right" Margin="0,-18,0,0" Height="20" Padding="0,0,0,0" />
     </StackPanel>
</Button>

This worked perfectly, until i started using a MVVM Framework (Caliburn.Micro). From that point on the images no longer show up in the buttons, just the text. I can't figure out why it doesn't work.

Maybe someone with knowledge of MVVM Frameworks can explain this or give me a solution :)

Thanks in advance!

EDIT:

Never mind! I looked it over thanks to H.B. and it seemed I moved the View to a subfolder. I changed the image source from "Images\11.png" to "..\Images\11.png" and it worked!


Solution

  • Just change your image source from "Images\11.png" to "..\Images\11.png" and it will work.