我有一个网格控件,它有25个按钮(网格只包含按钮)。并为每个按钮我这样设置相同的图像:WPF按钮背景问题
ImageBrush brush = new ImageBrush();
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(@"pack://application:,,,/Images/notexplored.jpg", UriKind.RelativeOrAbsolute);
bitmap.EndInit();
brush.ImageSource = bitmap;
foreach (UIElement uie in myGrid.Children)
{
var temp = uie as Button;
temp.Background = brush;
}
我的问题是,现在当我将鼠标悬停在按钮我得到这个(这个问题的短视频):https://www.dropbox.com/s/jb8fb29lrpimue5/ButtonIssue.avi
哪有我改正这个?将图像作为背景应用到按钮后,如果我将鼠标悬停在按钮上,我不想看到默认的按钮背景(看起来&感觉)而不是应用的图像。
顺便说一句,你有足够的代表现在upvote。 ;) – Athari