---
title: "Canvas Control in WPF"  
description: "In WPF we can XAML Canvas  element to create a Canvas control. This is a container control in which we can add child elements by using coordinates whi"  
author: "Anonymous User"  
published: 2011-04-05  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/536/canvas-control-in-wpf  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# Canvas Control in WPF

In WPF we can XAML <[Canvas](https://www.mindstick.com/forum/1383/how-can-i-print-a-canvas-in-wpf) /> element to create a Canvas [control](https://yourviews.mindstick.com/view/83439/bipartisan-gun-control-bill-passed-in-us-after-decades). This is a [container](https://www.mindstick.com/forum/34127/extjs-how-to-set-border-for-the-container) control in which we can add child [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements) by using coordinates which is [relative](https://answers.mindstick.com/qa/105067/how-to-trade-with-the-relative-vigor-index) to canvas area. The coordinates can be specified relative to any side of the panel using the Canvas.Left, Canvas.Right, Canvas.Top and Canvas.Bottom. The panel is used mainly used to group 2d [graphics](https://www.mindstick.com/articles/336067/html-graphics-using-html) element. Some [common](https://yourviews.mindstick.com/story/1215/the-most-common-sexually-transmitted-infections) [properties](https://yourviews.mindstick.com/view/81845/now-it-s-possible-to-predict-properties-of-any-molecule) of the Canvas control are as follows…\

- If Left [property](https://www.mindstick.com/articles/198559/an-ownership-of-property-in-hua-hin) of Canvas control is set by calling Canvas.Left property then Right property does not work and if Canvas.Top property is set then Canvas.Bottom property does not work and vice versa.
- The [vertical](https://www.mindstick.com/forum/12951/how-to-fix-bootstrap-tab-vertical-with-text) and horizontal alignment on child element did not work. Child elements are placed on position set by the Canvas Left, Top, Right and Bottom properties.

##### The following code snippet represents use of Canvas control

```
<Canvas>        <Rectangle Canvas.Left="40" Canvas.Top="40" Width="200" Height="100" Fill="BlanchedAlmond"/>        <Ellipse Canvas.Right="70" Canvas.Top="110" Width="100" Height="100" Fill="DarkCyan" /></Canvas>
```

##### The output of the following code snippet is as follows

![Canvas Control in WPF](https://www.mindstick.com/mindstickarticle/636715a3-6f8b-4542-8007-c28f4941c8f4/images/d7cbbe49-4d5c-4cc2-a694-87bda50d281b.png)

---

Original Source: https://www.mindstick.com/articles/536/canvas-control-in-wpf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
