/// <summary> /// Remove selected from the Listview item /// </summary> private void removeItem() { // Escape if their is no selection if (JobsDataGrid.SelectedIndex == -1) { return; } // get the current selection int selectedIndex = JobsDataGrid.SelectedIndex; // Remmove the selected Item Jobs.RemoveAt(JobsDataGrid.SelectedIndex); // Change the Selected index if (Jobs.Count <= selectedIndex) { selectedIndex--; } // Set the new Selection JobsDataGrid.SelectedIndex = selectedIndex; // Set the Focus to the Object. So we see the right Selection color JobsDataGrid.Focus(); }
private void Order_ToJobButton_Click(object sender, RoutedEventArgs e) { var itemEntry = (CustomerOrderFullPOCO)CustomerOrdersDatagrid.SelectedItem; foreach (var item in JobsDataGrid.Items) { if (((FullJobPOCO)item).Id == itemEntry.Job.Id) { JobsDataGrid.SelectedItem = item; JobsDataGrid.ScrollIntoView(item); JobsDataGrid.Focus(); break; } } JobsFilterCompleted.IsChecked = false; JobsFilterWaitingComplete.IsChecked = false; JobsTab.IsSelected = true; JobsDataGrid_SelectionChanged(null, null); }