{"id":794,"date":"2019-02-14T16:00:21","date_gmt":"2019-02-14T16:00:21","guid":{"rendered":"https:\/\/ibex.tech\/windows-iot\/?p=794"},"modified":"2019-02-14T16:00:21","modified_gmt":"2019-02-14T16:00:21","slug":"canvas-instead-of-grid","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/canvas\/canvas-instead-of-grid","title":{"rendered":"Canvas instead of Grid"},"content":{"rendered":"\n<p>You can replace a pages &lt;Grid&gt; with &lt;Canvas&gt; instead if you want to use absolute positioning:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    &lt;Canvas Width=\"800\" Height=\"480\"&gt;\n\n        &lt;!-- IMAGE --&gt;\n        &lt;Image x:Name=\"imgBackground\" Source=\"Assets\/MyImage.png\" Stretch=\"UniformToFill\" \/&gt;\n\n        &lt;Rectangle Fill=\"Red\" Height=\"44\" Width=\"44\"\/&gt;\n        &lt;Rectangle Fill=\"Blue\" Height=\"44\" Width=\"44\" Canvas.Left=\"20\" Canvas.Top=\"20\"\/&gt;\n        &lt;Rectangle Fill=\"Green\" Height=\"44\" Width=\"44\" Canvas.Left=\"40\" Canvas.Top=\"40\"\/&gt;\n        &lt;Rectangle Fill=\"Orange\" Height=\"44\" Width=\"44\" Canvas.Left=\"60\" Canvas.Top=\"60\"\/&gt;\n    &lt;\/Canvas&gt;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Fill Parent Container \/ Screen<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;Canvas Background=\"#FFF7F7F7\" Width=\"{Binding Path=ActualWidth, ElementName=container}\" Height=\"{Binding Path=ActualHeight, ElementName=container}\"&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You can replace a pages &lt;Grid&gt; with &lt;Canvas&gt; instead if you want to use absolute positioning: Fill Parent Container \/ Screen<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[],"class_list":["post-794","post","type-post","status-publish","format-standard","hentry","category-canvas"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=794"}],"version-history":[{"count":0,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/794\/revisions"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}