0

I create an image-button using below code:



ImageBrush btnBrush1 = new ImageBrush();
 btnBrush1.Stretch = Stretch.Uniform;

btnBrush1.ImageSource = new BitmapImage(new Uri("ms-appx:/Images/icon_LogIn.png"));

btnLogIn.Background = btnBrush1;



The problem:

1) When using a mouse hovering the img-button, it turn grey background and icon disappear ( when not hovering the img-button, this image button is visible.

I want this image-button visible when hovering it or pressing it.

Thanks

MilkBottle
  • 4,242
  • 13
  • 64
  • 146

1 Answers1

0

You need to set Image as Content rather than setting ImageBrush as Background.
Try this

Image img=new Image();
img.Source=new BitmapImage(new Uri("/Images/icon_LogIn.jpg",UriKind.RelativeOrAbsolute));
btnLogIn.Content = img;
asitis
  • 3,023
  • 1
  • 31
  • 55