Page 1 of 1

Image on Button?

Posted: 17 Jun 2019, 13:18
by digimbyte
I'm looking at creating icons on buttons using textures
but I don't want to replace the existing background
is that possible?
My current code snippet, but it replaces the background of the entire button. is there an overlay or a content control that accepts images?
        BottomDock.Children.Add(new Button
        {
            Content = "test",
            Height = BottomStack.Height,
            MinWidth = 40,
            Background = new Noesis.ImageBrush
            {
                ImageSource = source,
                Stretch = Stretch.Uniform
            }
        });
my goal is to replicate this Image

Re: Image on Button?

Posted: 17 Jun 2019, 16:47
by sfernandez
The Button is a content control, so it provides a Content property you can set with an Image:
BottomDock.Children.Add(new Button
  {
    Height = BottomStack.Height,
    MinWidth = 40,
    Content = new Image
    {
      Source = source,
      Stretch = Stretch.Uniform
    }
});
Is this what you want?

Re: Image on Button?

Posted: 17 Jun 2019, 23:52
by digimbyte
I've tried attaching the image as the content before, I ended up with the name of the texture as text, so I assumed I was doing something wrong.

Thanks!