... This does not work ... This does not work ... This does not work

How do I assign a Canvas Width that is half of the Window Width in xaml?

67 Views Asked by At

I have:

<Window x:Class="qq.MainWindow"
  ...
  Width="500"
  Height="300" 
>
...
<Canvas x:Name="gca" 
        Width="250"
        Height="150" />

This does not work

<Canvas x:Name="gca" 
        Width=Window.Width / 2
        Height="150" />

How do I assign the Canvas Width to equal half of the Window Width?

0

There are 0 best solutions below