title: WPF/XAML bind width of an element to a fraction of screen size
body: <p>I am writing an application in C#/WPF and am trying to figure out how to databind the width of the grids column definitions to a fraction of the screen width. Is this possible? Essentially I want something like this:</p>
  
  <p>Grid = 2x2<br>
  Row 1 Height = 2/3 of screen height<br>
  Row 2 Height = 1/3 of screen height<br>
  Row 1 Width = 2/3 of screen width<br>
  Row 2 Width = 1/3 of screen width  </p>
  
  <p>I <em>think</em> that this correctly binds the full width to a column definition:</p>
  
  <pre><code>&lt;ColumnDefinition Width="{Binding ElementName=Window1, Path=Width}"/&gt;
  </code></pre>
  
  <p>but what I don't know how to do is perform an operation on the value it gets through the databinding... is this even possible? I feel like this is something I should be able to code into the XAML and not have to implement programmatically but I have little experience with UI design :( I would want something like:</p>
  
  <pre><code>&lt;ColumnDefinition Width="{Binding ElementName=Window1, Path=Width} * 2 / 3"/&gt;
  </code></pre>
  
  <p>but that is invalid</p>
  
  <p>Should I just be writing a function to re-layout UI elements whenever the screen resizes? I feel like that is redundant... or is there some easy way of doing this that I don't know about? Any input welcome! Thanks!</p>