C# – Windows 8 App, using canvas to draw outside of Grid control

Canvas size is always child driven so it will give infinite size for children. Also HorizontalAlignment and VerticalAlignment settings have no effect on a child of a Canvas. However even Canvas size is to zero, it does not affect to draw children.
By using this feature we can allow TextBloc to be displayed outside of Grid as shown the below example.

<Grid Width="200" Height="100">
    <Canvas>
        <TextBlock Text="Text in a Small Grid" FontSize="144" />
    </Canvas>
</Grid>
Advertisements
This entry was posted in .NET, Programming and tagged . Bookmark the permalink.

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