title: Adding UIElements to custom control (WPF)
body: <p>How can I create a custom control which takes a list of <code>UIElement</code>s and renders them according to some logic?</p>
  
  <p>Because it will handle a list of <code>UIElement</code>s, the best way of adding controls will be the same as for, i.e. <code>ListBox</code> or <code>ComboBox</code>.</p>
  
  <pre><code>&lt;local:SomeControl&gt;
      &lt;Button Content="First"/&gt;
      &lt;Label Content="Something other"/&gt;
  &lt;/local:SomeControl&gt;
  </code></pre>
  
  <p>Here is the user control's XAML:</p>
  
  <pre><code>&lt;UserControl x:Class="_2009_07_22_Wpf_Smooth_Scroller.SomeControl"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               MinHeight="100" MinWidth="100"&gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto" /&gt;
              &lt;RowDefinition Height="*" /&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Label Content="Some title"/&gt;
  
          &lt;!-- The inner UIElement to add content to  --&gt;
          &lt;Canvas x:Name="innerPanel" Grid.Row="1"/&gt;
  
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>How can I, for instance, place i-th control to location X = 50 * i, Y = 40 * i ?</p>