예제 #1
0
        //初始化LISTbOX
        private void InitialCarList()
        {
            List <Car> listCar = new List <Car>()
            {
                new Car()
                {
                    Automaker = "bwm", Name = "wql", Year = "1990", TopSpeed = "350"
                },
                new Car()
                {
                    Automaker = "bwm1", Name = "wqlwq", Year = "1998", TopSpeed = "350"
                },
                new Car()
                {
                    Automaker = "bwm2", Name = "wqlwq", Year = "1950", TopSpeed = "350"
                },
                new Car()
                {
                    Automaker = "bwm3", Name = "wqwql", Year = "2090", TopSpeed = "500"
                }
            };

            foreach (Car car in listCar)
            {
                CatListItemView view = new CatListItemView();
                view.Car = car;
                listBoxCars.Items.Add(view);
            }
        }
예제 #2
0
        private void listBoxCars_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            CatListItemView view = e.AddedItems[0] as CatListItemView;

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