Canvas

Canvas is the most basic panel, because it supports only the “classic” notion of positioning elements with explicit coordinates. You can position elements in a Canvas by using its Left and Top properties. These properties are special attached properties that can be attached to other elements. Listing 4.1 demonstrates this, with attached property syntax seen in Chapter 1 with automation properties.

LISTING 4.1 Buttons Arranged in a Canvas

<Page ...>   <Canvas x:Name="canvas">     <Button Background="Red">Left=0, Top=0</Button>     <Button x:Name="b" Canvas.Left =" 25" Canvas.Top =" 25"             Background="Orange">Left=25, Top=25</Button>   </Canvas> </Page>

When the XAML parser encounters this Canvas.Left ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.