#393 – Canvas Element

The Canvas panel serves as a container for a collection of child elements and allows positioning its children using exact coordinates (in WPF Units).

You can specify the following attached properties for a child element of the Canvas, to control how the child element is positioned.

  • Left – Distance between left side of element and left side of canvas
  • Top – Distance between top side of element and top side of canvas
  • Right – Distance between right side of element and right side of canvas
  • Bottom – Distance between bottom side of element and bottom of canvas

If you don’t specify values for any of these properties for a child element, it will be positioned in the upper left corner of the Canvas.

        <Label Content="Pease Porridge Hot"/>
        <Label Content="Pease Porridge Cold" Canvas.Left="99" Canvas.Top="23" />
        <Button Content="In the Pot" Canvas.Left="55" Canvas.Top="63" />
        <TextBox Text="Nine Days Old" Canvas.Left="161" Canvas.Top="111" />


About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

One Response to #393 – Canvas Element

  1. Pingback: #473 – Positioning Child Elements in a Canvas « 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: