August 21, 2009

MouseOver and MouseOut Scripts for SilverLight

MouseOver Animation for text and shapes
private void rectangle_MouseEnter(object sender, MouseEventArgs e)
{
VisualStateManager.GoToState(this,”hover”,true);
}

private void rectangle_MouseLeave(object sender, MouseEventArgs e)
{
VisualStateManager.GoToState(this, “mout”, true);
}


Rollover Color Effect in Silverlight
private void design_txt_MouseEnter(object sender, MouseEventArgs e)
{
design_txt.Foreground = new SolidColorBrush(Color.FromArgb(255, 0xFF, 0×66, 0×00));
}
private void design_txt_MouseLeave(object sender, MouseEventArgs e)
{
design_txt.Foreground = new SolidColorBrush(Colors.Black);
}

No comments: