title: Dynamic WPF form creation approaches
body: <p>I'm about to create a dynamic WPF UI form from DataTable data. The screens would be fairly complex. They would contain textboxes, groupboxes, checkboxes, buttons, datagrids etc. Some of them visible, some hooked up event handlers and thing like that. </p>
  
  <p>What approach of creating those dynamic screens would you choose considering performance impact and complexity requirements to write and maintain source code. Please note that this code will run a LOT so it must be efficient and blazing fast. I'm considering these options:</p>
  
  <ol>
  <li>Create Controls in code, assemble them to a tree and use the tree (Grid control) as a root element for a WPF form.</li>
  </ol>
  
  <p>1.a) Create a XAML via XAMLReader from that screen object tree and Load it via XAMLReader inside WPF Form. Creating XAML would seem redundant to me since I can use the built tree as a Content for WPF form directly.</p>
  
  <ol start="2">
  <li>Use XMLDocument class to create tags, obejcts and their atributes. Create a XAMLlike that and then load that XAML in WPF form.</li>
  </ol>
  
  <p>Thanks,</p>
  
  <p>Michal</p>