You are here: Blog Login
Categories
Archive
Search

Software development matters
Jul 11

Written by: Oleg Zhukov
7/11/2008 1:51 AM

In WinForms controls' overlapping (z-order, in other words) is adjusted easily by calling Control.BringToFront() and Control.SendToBack() methods. In Silverlight 2.0 the way to change z-order is not as straightforward although quite simple too.

First of all the default overlapping is controlled by the order in which controls appear in XAML: each subsequent element is placed on the top of the previous ones, like in the example below:

 

For changing the z-order in the XAML markup the Canvas.ZIndex attached property should be applied to elements. Higher property values place the control on the top of others: 

The same effect can be achieved through the C# code by using Canvas.SetZIndex(...) static method:

Tags:
Copyright 2007-2009 by Oleg Zhukov Terms Of UsePrivacy Statement