#477 – Default ZIndex Value for Child Elements of a Canvas

You can set the Canvas.ZIndex attached property for a child element of the Canvas panel, to dictate the overlap behavior of child elements.  Elements with a higher ZIndex value will appear on top of elements with a lower value.

By default, all child elements of a Canvas have a ZIndex value of 0.  In this case, the Canvas lays out the child elements in the order that they exist in the Children collection (the same order in which they appear in XAML), with elements occurring later in the collection layering on top of elements that occur earlier in the collection.

More generally, any time that two elements have the same value for ZIndex, they are layered in the order in which the appear in the Children collection.


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

3 Responses to #477 – Default ZIndex Value for Child Elements of a Canvas

  1. Pingback: Dew Drop – January 20, 2012 (#1,247) | Alvin Ashcraft's Morning Dew

  2. Abdellah says:

    Hello,

    I want to get the lowest ZIndex value of a Canvas, to implement something i want!!!

    THANKS

    • Sean says:

      The lowest ZIndex will be whatever you set it as. In other words, you can set ZIndex values to anything that you want.

Leave a comment