private void RemoveButton_Click(object sender, RoutedEventArgs e) { DependencyObject button = e.OriginalSource as DependencyObject; // Button DependencyObject contentpresenter = VisualTreeHelper.GetParent(button); // ContentPresenter if (contentpresenter is ContentPresenter) { Data.PawnQueueItem pawntoremove = (Data.PawnQueueItem)((ContentPresenter)contentpresenter).Content; int index = selectedpawnsqueue.IndexOf(pawntoremove); //Data.PawnCalcSelection pawncalcselection = (Data.PawnCalcSelection)redeemactioncombobox.SelectionBoxItem; availablepawnsqueue.Add(pawntoremove); selectedpawnsqueue.RemoveAt(index); } UpdateTotals(); SelectedPawnsListView.ItemsSource = selectedpawnsqueue; }
private void ActionAddButton_Click(object sender, RoutedEventArgs e) { DependencyObject button = e.OriginalSource as DependencyObject; // Button DependencyObject stackpanel = VisualTreeHelper.GetParent(button); // StackPanel DependencyObject contentpresenter = VisualTreeHelper.GetParent(stackpanel); // ContentPresenter if (contentpresenter is ContentPresenter) { Data.PawnQueueItem pawntoadd = (Data.PawnQueueItem)((ContentPresenter)contentpresenter).Content; int index = availablepawnsqueue.IndexOf(pawntoadd); //availablepawnsqueue[index].InQueue = true; //pawntoadd.InQueue = true; ComboBox redeemactioncombobox = (ComboBox)((StackPanel)stackpanel).Children[1]; Data.PawnCalcSelection pawncalcselection = (Data.PawnCalcSelection)redeemactioncombobox.SelectionBoxItem; selectedpawnsqueue.Add(new Shell.Data.PawnQueueItem(pawntoadd.Pawn, pawncalcselection)); availablepawnsqueue.RemoveAt(index); } UpdateTotals(); SelectedPawnsListView.ItemsSource = selectedpawnsqueue; }