title: How to add UIElement to List<UIElement>?
body: <p>I try to add two <code>Canvas</code> to a <code>List&lt;Canvas&gt;</code>, but I receive exception from the following code:</p>
  
  <pre><code>List&lt;Canvas&gt; cvList = new List&lt;Canvas&gt;();
  
  Canvas cv = new Canvas();
  cv.Width = 100; 
  cv.Height = 100;
  
  cvList.Add(cv); // adding first Canvas to List&lt;Canvas&gt;
  cvList.Add(cv); // adding the second Canvas to List&lt;Canvas&gt;
  ...
  </code></pre>
  
  <p>To elaborate more on the issue, each <code>Canvas</code> has to be distinct since each may Children different <code>TextBox</code>, Label and other <code>UIElement</code>. So I think the above code shouldn't work. However though I cannot do this:</p>
  
  <pre><code>Canvas cv1 = new Canvas();
  cv1.Width = 100;
  Canvas cv2 = new Canvas();
  cv2.Width = 250;
  ...
  
  Or 
  
  Canvas[] cv = new Canvas[myInt];
  </code></pre>
  
  <p>I cannot do the above because the size of the List is determine at run time and I cannot assign a size to an Array or declare each array individually. </p>
  
  <p>How to do this correctly? Yes, I've read the List on MSDN, but the site didn't tell me how to do so. Thanks.</p>