views:

311

answers:

1

I have an animation that I have setup on a transparent canvas. I set that canvas to be the content of a button and then run the animation. (See this question for the code.)

The problem is that sometimes the animation gets put behind other UI elements of my app (I am using Avalon Dock and it is in front of the DockableContent it is in, but behind the one next to it.) In some tests this seems to be tied in some way to the size of the button (if it overflows the DockableContent).

Any idea how I can bring the canvas to be on top of it all? (Note: I am not trying to raise elements in the canvas over other elements in the canvas.)

Thanks for any help.


Edit: This was happening because I have a ScrollViewer around the button that was holding the animation canvas. This caused it to expand rather than overwrite.

I can think of a few workarounds, but I am open to suggestions.

+1  A: 

Change the value of the Panel.ZIndex attached property. A higher value means closer to the foreground

Thomas Levesque
I cannot find Panel.ZIndex on the Canvas object. (ie myCanvas.Panel.ZIndex is not a valid reference)
Vaccano
It is an *attached* property, you can't refer to it like that. You have to call it that way : `Panel.SetZIndex(myCanvas, 10)`. In XAML you can refer to it with `Panel.ZIndex`
Thomas Levesque
Wow! Good answer. Thanks
Vaccano