title: Dynamically creating WrapPanel buttons
body: <p>I have a table storing purchased items and the entity class using in NHibernate:</p>
  
  <pre><code>public class PurchasedItem
  {
      public virtual int Id          { get; set; }
      public virtual Product Product { get; set; }
      public virtual int SortSale    { get; set; }
  }
  </code></pre>
  
  <p>I would like to reduce the code duplication by getting all records from the <code>PurchasedItems</code> table (<code>IList &lt;PurchasedItem&gt;</code> object). Records have been sorted in descending order by <code>SortSale</code> column. What's the best way of creating <code>WrapPanel</code> buttons based on the <code>IList &lt;PurchasedItem&gt;</code> object? I would like to assign the event handler for each button as well. The button displays a title with the name of the product.</p>