Exemplo n.º 1
0
        private void InitialCarList()
        {
            List <Car> carList = new List <Car>()
            {
                new Car()
                {
                    AutoMaker = "1", Name = "1", Year = "1", TopSpeed = "1"
                },
                new Car()
                {
                    AutoMaker = "2", Name = "2", Year = "1", TopSpeed = "1"
                },
                new Car()
                {
                    AutoMaker = "3", Name = "3", Year = "1", TopSpeed = "1"
                },
                new Car()
                {
                    AutoMaker = "4", Name = "4", Year = "1", TopSpeed = "1"
                },
                new Car()
                {
                    AutoMaker = "5", Name = "5", Year = "1", TopSpeed = "1"
                }
            };

            foreach (Car car in carList)
            {
                CarListItemView view = new CarListItemView();
                view.Car = car;
                this.listBoxCar.Items.Add(view);
            }
        }
Exemplo n.º 2
0
        private void listBoxCar_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            CarListItemView view = e.AddedItems[0] as CarListItemView;

            if (view != null)
            {
                this.detailView.Car = view.Car;
            }
        }