示例#1
0
        public DataGrid_Demo()
        {
            this.InitializeComponent();

            // Populate the data grid with the list of planets:
            DataGrid1.ItemsSource = Planet.GetListOfPlanets();
        }
        public Binding1_Demo()
        {
            this.InitializeComponent();

            ObservableCollection <Planet> listOfPlanets = Planet.GetListOfPlanets();

            ItemsControl1.ItemsSource = listOfPlanets;
            ContentControl1.Content   = listOfPlanets[0];
        }
示例#3
0
        void ButtonToDemonstrateLinq_Click(object sender, RoutedEventArgs e)
        {
            var planets = Planet.GetListOfPlanets();

            var result = from p in planets
                         where p.Radius > 7000
                         orderby p.Name
                         select p.Name;

            MessageBox.Show(string.Format("List of planets that have a radius greater than 7000km sorted alphabetically: {0}", string.Join(", ", result)));
        }
示例#4
0
        public ComboBox_Demo()
        {
            this.InitializeComponent();

            ComboBox1.ItemsSource = Planet.GetListOfPlanets();
        }