How do I bring an item to the front in wpf?

Jonathan Beerhalter picture Jonathan Beerhalter · Jan 17, 2009 · Viewed 44.7k times · Source

I simply have two grid on top of one another. Given one state of the world, I want grid A to be on top, given another state of the world, I want grid B to be on top. In the old days we could just call grid.BringToFront(), but that doesn't exist anymore, and I can't figure out any way to make that happen.

The best I can figure, I need to create my own custom classes to allow this functionality, but that seems like major overkill for something that used to be so simple.

Answer

Ifeanyi Echeruo picture Ifeanyi Echeruo · Jan 17, 2009

You can use the Panel.ZIndex property to change the display order of elements in a panel