Dynamic filling WrapPanel buttons from DB, setting the event handlers

Posted by Anry on Stack Overflow See other posts from Stack Overflow or by Anry
Published on 2010-05-04T15:57:16Z Indexed on 2010/05/04 16:38 UTC
Read the original article Hit count: 279

Filed under:
|
|
|

I have a table:

alt text

I'm using NHibernate. The class of entity:

public class PurchasedItem
{
    public virtual int Id { get; set; }
    public virtual Product Product { get; set; }
    public virtual int SortSale { get; set; }
}

I want to get all the records table PurchasedItems (my method returns an IList ). Records are sorted in descending order (column SortSale). How to fill WrapPanel buttons from the list IList ? For each button assign the event handler. By pressing the button display a message with the name of the product.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about wrappanel