Silverlight - 在代码隐藏中动画矩形描边
当用户将鼠标悬停在我的应用程序中的矩形上时,我希望能够在代码隐藏 (C#) 中淡入边框。
我已经看到了一些在代码隐藏中创建动画的示例,但无法让它们适用于此实例。
正如您所看到的,我有一个 MouseEnter 事件,目前在对象周围创建了一个边框,但我希望它淡入(当我有 MouseLeave 事件时淡出)
您能帮助理解我需要什么吗?
私有无效ImageRect_MouseEnter(对象发送者,MouseEventArgs e) { SolidColorBrush blueBrush = new SolidColorBrush(); blueBrush.Color = SystemColors.HighlightColor; ImageRect.StrokeThickness = 3; ImageRect.Stroke = blueBrush; 肖恩
非常
感谢
I want to be able to Fade In a Border in Code Behind (C#) when the user hovers over a Rectangle in my application.
I've seen a few examples of creating animations in Code behind but cannot get them to work for this instance.
As you can see, I have a MouseEnter event that at the moment, created a border around the object but I want this to Fade In (and out when I have a MouseLeave event)
Can you please help to understand what I need?
private void ImageRect_MouseEnter(object sender, MouseEventArgs e)
{
SolidColorBrush blueBrush = new SolidColorBrush();
blueBrush.Color = SystemColors.HighlightColor;
ImageRect.StrokeThickness = 3;
ImageRect.Stroke = blueBrush;
}
Thanks very much
Shaun
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您想在代码隐藏中创建故事板时,请尝试使用此选项。
try to use this when you want to create storyboard in code behind.