WPF Animation - Bring a Canvas to front
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 t开发者_开发知识库he 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.
Change the value of the Panel.ZIndex
attached property. A higher value means closer to the foreground
精彩评论