Partager via


The ZIndex Property -- At Last!

There are a handful of new features in Beta 2 and lots of performance tweaks and bug fixes.  My favorite new feature: the ZIndex property!  Hooray!  Anyone who has dabbled with WPF even remotely has requested this feature and now we have it -- an attached property on every FrameworkElement!  And, of course, it is a DependencyProperty, so you can animate it. Here's a simple code sample:

<Page xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" WindowTitle="ZIndex Sample">
<Canvas>
<Rectangle Canvas.ZIndex="3" Width="100" Height="100" Canvas.Top="100" Canvas.Left="100" Fill="blue"/>
<Rectangle Canvas.ZIndex="1" Width="100" Height="100" Canvas.Top="150" Canvas.Left="150" Fill="yellow"/>
<Rectangle Canvas.ZIndex="2" Width="100" Height="100" Canvas.Top="200" Canvas.Left="200" Fill="green"/>

    <!-- Reverse the order to illustrate z-index property -->

    <Rectangle Canvas.ZIndex="1" Width="100" Height="100" Canvas.Top="300" Canvas.Left="200" Fill="green"/>
<Rectangle Canvas.ZIndex="3" Width="100" Height="100" Canvas.Top="350" Canvas.Left="150" Fill="yellow"/>
<Rectangle Canvas.ZIndex="2" Width="100" Height="100" Canvas.Top="400" Canvas.Left="100" Fill="blue"/>
</Canvas>
</Page>

Comments

  • Anonymous
    May 23, 2006
    Karsten, - could you provide a list of changes from the feb CTP to Beta 2?

    Thanks!

  • Anonymous
    May 23, 2006
    The list is so short, in fact I think the only new API is the ZIndex property, and the breaking changes are so obscure, that we didn't do one this time...

  • Anonymous
    May 23, 2006
    Una&amp;nbsp;novit&#224;&amp;nbsp;di&amp;nbsp;interesse nella nuova&amp;nbsp;Beta2 di WinFX &#232; la propriet&#224; ZIndex di un&amp;nbsp;panel,&amp;nbsp;permette...

  • Anonymous
    May 24, 2006
    Ok, so one of the things I hope to achieve with this blog is to share all of the little gems that I come...

  • Anonymous
    June 06, 2006
    In this post http://gbarnett.org/archive/2006/05/05/9.aspx&amp;nbsp;I demonstrated depths and how they are...

  • Anonymous
    June 20, 2006
    Persone los pioneros non rabata. Great...

  • Anonymous
    November 17, 2006
    In this post http://gbarnett.org/archive/2006/05/05/9.aspx I demonstrated depths and how they are rendered

  • Anonymous
    January 08, 2007
    In this post http://gbarnett.org/archive/2006/05/05/9.aspx I demonstrated depths and how they are rendered

  • Anonymous
    February 26, 2007
    Ok, so one of the things I hope to achieve with this blog is to share all of the little gems that I come

  • Anonymous
    June 17, 2009
    PingBack from http://patioumbrellasource.info/story.php?id=653