I am creting some border objects on a canvas through code behind. I don't have any XAML for these borders. Their opacity by default is set to 0.5 and I want to change their opacity to 1 on mouse enter. This is the code I have to try and make a mouse enter event for them. But it doesn not work. I think I have to cast the sender object as a border is that correct?
br.MouseEnter += new MouseEventHandler(br_MouseEnter);
void br_MouseEnter(object sender, MouseEventArgs e)
{
sender.Opacity = 1.0;
}