[英]Change background color of HyperLinkButton on MouseOver/MouseEnter in Silverlight
我是Silverlight的新手,任何人都可以指導我如何做到這一點。
謝謝
XAML:
<HyperlinkButton Name="hyperlinkButton" Content="Change Background" MouseEnter="hyperlinkButton_MouseEnter" MouseLeave="hyperlinkButton_MouseLeave" />
背后的代碼:
private void hyperlinkButton_MouseEnter(object sender, MouseEventArgs e)
{
hyperlinkButton.Background = new SolidColorBrush(Colors.Red);
}
private void hyperlinkButton_MouseLeave(object sender, MouseEventArgs e)
{
hyperlinkButton.Background = new SolidColorBrush(Colors.White);
}
這是視頻教程“如何設置超鏈接按鈕的樣式”。 在那里你可以看到
How to change the color of a Hyperlink Button when the mouse is over it.
也可以下載源代碼。
如果您希望按照@BurkDigglers的說明進行操作,則必須為每個超鏈接按鈕處理MouseEnter
和MouseLeave
事件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.