Example #1
0
        private void Select_Checked(object sender, RoutedEventArgs e)
        {
            ulong pokemonId = (ulong)((CheckBox)sender).CommandParameter;

            UpdateTransferAllButtonState();

            OnPokemonItemSelected?.Invoke(null);
        }
Example #2
0
        private void gridData_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var data  = DataContext as PokemonListModel;
            var count = data.Pokemons.Count(x => x.IsSelected);

            //TODO : Thought it will better to use binding.
            btnTransferAll.Content = $"Transfer all ({count})";
            if (count > 1)
            {
                btnTransferAll.IsEnabled = true;
            }

            OnPokemonItemSelected?.Invoke(null);
        }
Example #3
0
        private void GridData_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // The bulk selection only works when 2 or more rows are selected.  This is to work around
            // issues with the checkbox and row selection when only one row is clicked.
            if ((sender as DataGrid).SelectedItems.Count > 1)
            {
                foreach (PokemonDataViewModel pokemon in (sender as DataGrid).SelectedItems)
                {
                    pokemon.IsSelected = true;
                }
            }

            UpdateTransferAllButtonState();

            OnPokemonItemSelected?.Invoke(null);
        }
        private void Select_Checked(object sender, RoutedEventArgs e)
        {
            ulong pokemonId = (ulong)((CheckBox)sender).CommandParameter;

            var data  = DataContext as PokemonListModel;
            var count = data.Pokemons.Count(x => x.IsSelected);

            //TODO : Thought it will better to use binding.
            btnTransferAll.Content = $"Transfer all ({count})";
            if (count > 1)
            {
                btnTransferAll.IsEnabled = true;
            }

            OnPokemonItemSelected?.Invoke(null);
        }
        private void gridData_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // The bulk selection only works when 2 or more rows are selected.  This is to work around
            // issues with the checkbox and row selection when only one row is clicked.
            if (e.AddedItems.Count > 1)
            {
                foreach (PokemonDataViewModel pokemon in e.AddedItems)
                {
                    pokemon.IsSelected = true;
                }
            }

            var data  = DataContext as PokemonListModel;
            var count = data.Pokemons.Count(x => x.IsSelected);

            //TODO : Thought it will better to use binding.
            btnTransferAll.Content = $"Transfer all ({count})";
            if (count > 1)
            {
                btnTransferAll.IsEnabled = true;
            }

            OnPokemonItemSelected?.Invoke(null);
        }