Пример #1
0
        private void lstbxGames_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Adds Image to imagebox and price to textbloxk
            Game.GameData db           = new Game.GameData();
            Game          selectedGame = lstbxGames.SelectedItem as Game;

            if (selectedGame != null)
            {
                tbxGames.Text = selectedGame.Price.ToString();

                imgGames.Source = new BitmapImage(new Uri(selectedGame.Game_Image, UriKind.Relative));
            }
        }
Пример #2
0
        private void cbxPlatform_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Filters games in the listbox by their platform
            Game.GameData db = new Game.GameData();

            lstbxGames.ItemsSource = null;

            var query = from g in db.Games
                        where cbxPlatform.SelectedItem.ToString() == g.Platform
                        select g;

            AllGames = query.ToList();
            lstbxGames.ItemsSource = AllGames;
        }
Пример #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Initial query to fill Listbox
            Game.GameData db = new Game.GameData();

            string[] platforms = { "PC, Xbox, PS, Switch", "PS", "Xbox", "Switch" };
            cbxPlatform.ItemsSource = platforms;

            var query = from g in db.Games
                        select g;

            AllGames = query.ToList();

            lstbxGames.ItemsSource = AllGames;
        }