I have a different style for the items in my listbox on MouseOver which gives a slight zoom effect. This works nicely, but since the ZIndex is set in the order items are added to the ListBox, the zoomed item will be drawn behind the next item. I would like to set it so that the zoomed item is on top.
I've tried creating a MouseOver eventhandler, and setting the ZIndexProperty like this
private void ListItem_MouseEnter(object sender, MouseEventArgs e)
{
var grid = sender as Grid;
grid.SetValue(Canvas.ZIndexProperty, 5);
}
This doesn't work, and if I check the ZIndex without setting it at all, I always get 0 so it's like I'm not looking at the correct value. How can I modify the correct ZIndexProperty?