title: Determining size of a control before rendering process
body: <p>I've got a composite control consisting of a rectangle and a few dynamically created labels (dynamically, because during design time I don't know how many labels shall be displayed). The labels' positions (margins) are evaluated during run time by combining whole control size, additional collection passed through dependency property and by heights of labels themselves.</p>
  
  <p>Unfortunately, I didn't came into deterministic way of determining label height before one was rendered. <code>ActualWidth</code> and <code>ActualHeight</code> are 0 before the labels are displayed, Width/Height is not set, because I wish the labels to size themselves basing on their contents, <code>DesiredSize</code> returns either 0, correct size or size exceeding the real label size (like 2 or 3 times), <code>RenderSize</code> returns either valid size or 0 and it is like first label returns valid size and second one - 0.0, without any noticeable reason.</p>
  
  <p>I've tried calling <code>Measure()</code> on the labels with double.PositiveInfinity passed by only to reach situation, when <code>DesiredSize</code> was way bigger than expected (all labels have the same font and consist only of numbers, so they all shall have more less similar size, but first had ~16 pixels, second - ~36, though after the rendering, <code>RenderSize</code> was valid for both of them).</p>
  
  <p>Is there a <em>deterministic</em> way to check desired control size, based only on its contents (not on alignment/margins) <em>before</em> it is rendered on screen?</p>