Panel.SetZIndex Method (UIElement, Int32)
Sets the value of the ZIndex attached property for a given element.
Assembly: PresentationFramework (in PresentationFramework.dll)
Parameters
- element
-
Type:
System.Windows.UIElement
The element on which to apply the property value.
- value
-
Type:
System.Int32
The order on the z-plane in which this element appears.
| Exception | Condition |
|---|---|
| ArgumentNullException | The element is null. |
The greater the value of a given element, the more likely the element is to appear in the foreground. Likewise, if an element has a relatively low value, the element will likely appear in the background. For example, an element that has a value of 5 will appear above an element that has a value of 4, which in turn will appear above an element that has a value of 3, and so on. Negative values are allowed, and they continue this precedence pattern.
Members of a Children collection that have equal ZIndex values are rendered in the order in which they appear in the visual tree. You can determine the index position of a child by iterating the members of the Children collection.
Available since 3.0