title: WPF custom control size override
body: <p>I'm creating a custom WPF control which derives from Grid.
  It's a Chess board and so I want it's width to be the same as it's height.
  How can I accomplish this?</p>
  
  <p>Edit:</p>
  
  <p>I tried the following.</p>
  
  <pre><code>private void cbcBoard_SizeChanged(object sender, SizeChangedEventArgs e)
      {
          if (e.NewSize.Width != e.NewSize.Height)
          {
              double m = Math.Min(e.NewSize.Width, e.NewSize.Height);
  
              cbcBoard.Width = m;
              cbcBoard.Height = m;
          }
      }
  </code></pre>
  
  <p>It didn't work. Any ideas?</p>
  
  <p>Thanks.</p>