title: ItemsControl with only custom subelements
body: <p>I would like to build a custom component that layouts its childs in either a <code>StackPanel</code> or a <code>Grid</code> (with variable row count, which makes me consider the <code>StackPanel</code> instead). The items are custom elements/objects that just hold some configuration, based on which a few controls are created to display them (some labels and text boxes).</p>
  
  <p>Ideally, the component should be used somehow like this (where <code>SpecializedCustomPanelItem</code> is a subtype of <code>CustomPanelItem</code>):</p>
  
  <pre><code>&lt;CustomPanel&gt;
      &lt;CustomPanelItem Param1="value A" Param2="value B"&gt;Text&lt;/CustomPanelItem&gt;
      &lt;CustomPanelItem Param1="value C"&gt;Other text&lt;/CustomPanelItem&gt;
      &lt;SpecializedCustomPanelItem&gt;More text&lt;/SpecializedCustomPanelItem&gt;
      &lt;!-- The number of items is variable --&gt;
  &lt;/CustomPanel&gt;
  </code></pre>
  
  <p>I’ve read on the <code>ItemsControl</code> for a while now, and it fits my needs rather well. I would create simply types for the items, and make data templates for them available from inside the <code>ItemsControl</code>. Then they should already render fine.</p>
  
  <p>However I would like to require the items inside that <code>ItemsControl</code> to be of a specific type (i.e. <code>CustomPanelItem</code> or a subtype). I actually thought that the <code>ItemsControl</code> would allow this, just like you within a <code>ComboBox</code> or a <code>MenuItem</code>, but it turns out that it actually allows any subtype, and if necessary wraps them in a item container.</p>
  
  <p>So I have been thinking if an <code>ItemsControl</code> is actually what I am looking for, as I do not want any “fancy” things like selection or scrolling which most of those controls implement. I actually only want to build a simple interface to a common pattern in the application that auto generates those components and layouts them in a <code>Grid</code>/<code>StackPanel</code>.</p>
  
  <p>Should I still be using the <code>ItemsControl</code> or rather build some more custom component?</p>