title: How can I limit the height of a window to a percent of the screen resolution using the MVVM pattern?
body: <p>I have a window that is configured in this way:</p>
  
  <pre><code>&lt;Window x:Class="Catalogo.Views.dlgGenerosContenidosAsignarView"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="dlgGenerosAsignar"
          SizeToContent="WidthAndHeight"
          WindowStartupLocation="CenterOwner"&gt;
  </code></pre>
  
  <p>I want the window to adjust to its content, so I use <code>SizeToContent="WidthAndHeight"</code>. But if the content is too big, it can outsize the screen, so I would like to limit the value of the <code>MaxHeight</code> attribute to the height of the screen.</p>
  
  <p>How could I do this using the MVVM pattern?</p>
  
  <p>I could use binding to a property in my ViewModel that uses the <code>System.Windows.SystemParameters</code> to get the height of the screen and set a property that binds to the View, but I think that the size of the window should be set in the View, not the ViewModel, so I would like to know if there is another solution.</p>