Click here to Skip to main content
15,885,365 members
Articles / Desktop Programming / WPF

How To Embed An Application Into a Docking Library

Rate me:
Please Sign up or sign in to vote.
5.00/5 (6 votes)
3 Sep 2011CPOL7 min read 29.3K   2.5K   19  
Step by Step conversion of an application into a Docking application component
/************************************* Module Header **************************************\
* Module Name:  CustomerList.cs
* Project:      CSWPFMasterDetailBinding
* Copyright (c) Microsoft Corporation.
* 
* This example demonstrates how to do master/detail data binding in WPF.
* 
* 
* This source is subject to the Microsoft Public License.
* See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
* All other rights reserved.
* 
* History:
* * 10/29/2009 3:00 PM Zhi-Xin Created
 * 
\******************************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace CSWPFMasterDetailBinding.Data
{
    class CustomerList
    {
        private ObservableCollection<Customer> _customers;

        public CustomerList()
        {
            _customers = new ObservableCollection<Customer>();

            // Insert customer and corresponding order information into
            Customer c = new Customer() { ID = 1, Name = "Customer1" };
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 1, 1), ShipCity = "Shanghai" });
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 2, 1), ShipCity = "Beijing" });
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 11, 10), ShipCity = "Guangzhou" });
            _customers.Add(c);

            c = new Customer() { ID = 2, Name = "Customer2" };
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 1, 1), ShipCity = "New York" });
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 2, 1), ShipCity = "Seattle" });
            _customers.Add(c);

            c = new Customer() { ID = 3, Name = "Customer3" };
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 1, 1), ShipCity = "Xiamen" });
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 2, 1), ShipCity = "Shenzhen" });
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 11, 10), ShipCity = "Tianjin" });
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 11, 10), ShipCity = "Wuhan" });
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 11, 10), ShipCity = "Jinan" });
            _customers.Add(c);

            c = new Customer() { ID = 4, Name = "Customer4" };
            c.Orders.Add(new Order() { ID = 1, Date = new DateTime(2009, 1, 1), ShipCity = "Lanzhou" });
            _customers.Add(c);
        }

        public ObservableCollection<Customer> Customers
        {
            get { return _customers; }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions