BUTTON IMAGE BACKGROUND DISAPPEARS WHEN ON HOVER

ezra heywood

Total Post:145

Points:1019
Posted by  ezra heywood
C# 
C#
 1267  View(s)
Ratings:
Rate this:

When I create a button with a background and I hover over with my mouse, the background image disappears. Is there a way to override or cancel this process? I also read that I could set the image as content of the button, however I couldn't get the scaling right (filling the button) programmatically. Thanks in advance.

                                  

How I set the background:

BitmapImage bitmapImage = new BitmapImage(new Uri("http://www." + link + ".jpg"));

videoButton.Background = new ImageBrush()

{

   ImageSource = bitmapImage

};

  1. Pravesh Singh

    Post:412

    Points:2888
    Re: Button image background disappears when on hover

    Hi Ezra,


    Try this code

            var brush = new ImageBrush();

            brush.ImageSource = new BitmapImage(new Uri("Images/myimage.png"));

            Button1.Background = brush;

    I don’t think you set the background properly.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!