Crazy ZIndex in WPF

ZIndex represents the order on the z-plane in which an element appears. So consider whenever you are having two or more controls on top of each other and you want to handle, which need to be shown based on some requirement then surely this article will help you out in resolving that problem. Higher value of Zindex will make that control on top of all other controls.

Consider a scenario where we are having a ComboBox and on changing the selection in combobox you need to load different Grid with different style.

Here we are having 3 different Grid and one combobox Which will tell which grid we need to put on top of screen.

Xaml Code:



C# ViewModel Code: