Please see the comments to the question, by Wes Aday and mine.
Short answer: you need to use one of the most practically important XAML attribute value strings: "Auto". If you have a row definition with Height="Auto", its actual height will be defined by the content's controls; if you have a column definition with Width=Auto", its actual width will be defined by controls. Other width/height definitions give more complex behavior.
Background:
In WPF layout, there are too opposite approaches: ether the size of the content defines the size of the controller, or the size of the controller defines the size of the content (if it even fit, but it also can be scaled to any size). Here, by "container", I mean some
Panel
(
Grid
is also a
Panel
) or
Window
(
System.Windows.Controls.ContentControl
). The choice is independent for horizontal and vertical direction.
So, the whole behavior will also depend on the
Window
property
SizeToContent
:
http://msdn.microsoft.com/en-us/library/system.windows.window.sizetocontent%28v=vs.110%29.aspx[
^].
—SA