Scene Order (Layer Order) in XAML Silverlight


Introduction

XAML is fully based on composition of objects scenes. Every XAML page has a parent/top most container (like UserControl/Canvas/Page etc) and it may have zero more children elements like (like Grid/Rectange/Ellipse etc). Look at the example below:


In above screenshot, I have used three elements named LayoutRoot, LayoutRoot1 and Rec1. LayoutRoot (White Background) is lower most (beneath), look at the code above and examine the order of elements:

1.    LayoutRoot (Grid)
2.    LayoutRoot1 (Grid)
3.    Rec1 (Rectangle)

Please note that, usually we write code top to bottom approach in general so, the order of shapes (elements) also varies on this. If you wish to bring ‘LayoutRoot (White Grid)’ to front then the order of element will also be rearranged automatically. Look at screenshot below:


In above screenshot, I’m bringing the white art (LayoutRoot) to front then, in code window that grid will also be rearranged. Look at screenshot below:


In above screenshot, white art is now on top and the same code is also rearranged (means bottom to top).

That’s all about the order of shapes (elements) in XAML.

Comments

Popular posts from this blog

Migrating database from ASP.NET Identity to ASP.NET Core Identity

Customize User's Profile in ASP.NET Identity System

Lambda two tables and three tables inner join code samples