Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Wrap a Border Around the Content of a Canvas

How to: Wrap a Border Around the Content of a Canvas

This example shows how to wrap a Canvas element with a Border.

Example

The following example shows how to display Hello World! inside a Canvas element. The Canvas element is wrapped by a Border element so that a border outlines the element.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  <Border
    BorderThickness="2"
    BorderBrush="Black"
    Background="LightGray"
    HorizontalAlignment="Left"
    VerticalAlignment="Top"
    Width="100"
    Height="100">
    <Canvas>
      <TextBlock Canvas.Top="10" Canvas.Left="20">Hello World!</TextBlock>
    </Canvas>
  </Border>
</Page>    

See Also

Community Additions

ADD
Show:
© 2015 Microsoft