Tag Archives: entity-framework

Seeing design time data in a WPF control

Sometimes the ability to see the data at design time significantly facilitates the creation of WPF controls. If I am developing a WPF control with complex UI using data bound controls, I usually define a property for accessing some typical data item:

public static ComplexData DesignTimeItem
{
    get
    {
        using (DatabaseContext db = new DatabaseContext())
        {
            var products = from p in db.products.Include("ProductType")
                           where p.product_id == 131
                           select p;

            product product = products.First();

            return new ComplexData(product, "100 kg");
        }
    }
}

(more…)