title: WPF make element's top position fixed
body: <p>I have the following XAML in my WPF application:</p>
  
  <pre><code>&lt;Grid RenderTransformOrigin="0.524,0.496" Height="478" VerticalAlignment="Bottom"&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition Height="*"/&gt;
              &lt;/Grid.RowDefinitions&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="*"/&gt;
                  &lt;ColumnDefinition Width="*"/&gt;
              &lt;/Grid.ColumnDefinitions&gt;
              &lt;Canvas Grid.Row="0" Margin="0,22,0,0" Width="{Binding ActualWidth, ElementName=window, Mode=OneWay}" Background="AliceBlue" Height="43" HorizontalAlignment="Left" VerticalAlignment="Top"&gt;
                  &lt;Label x:Name="label" Content="Science Magazine - Papers" Canvas.Left="22" Canvas.Top="6" FontSize="16" Panel.ZIndex="1"/&gt;
              &lt;/Canvas&gt;
          &lt;/Grid&gt;
  </code></pre>
  
  <p>I wanted the canvas to be resizable with the window, which I achieved by binding its width with the width of the window. However, I also want it to stay at the same top position when the window is resized; instead, it does this:<a href="https://i.stack.imgur.com/9Vtaj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Vtaj.jpg" alt="enter image description here"></a></p>
  
  <p>I don't know how to fix this (since I'm a complete WPF beginner :) ) </p>