private void ChangeTag_OnClick(object sender, MouseButtonEventArgs e) { if (tw == null) { Tag tt = (Tag)((DataGrid)sender).SelectedItem; if (tt != null) { tw = new TagWindow(map, this); copy = tt; forChange = true; tw.TagID_Field.Text = tt.ID; tw.ClrPcker_Background.SelectedColor = (Color)ColorConverter.ConvertFromString(tt.Color); tw.TagDescription_Field.Text = tt.Description; tw.Show(); } else { MessageBox.Show("Please select one of the tags.", "Selection Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else { tw.Topmost = true; // important tw.Topmost = false; // important tw.Focus(); // important } }
private void NewTag_OnClick(object sender, RoutedEventArgs e) { if (tw == null) { tw = new TagWindow(map, this); tw.Show(); } else { tw.Topmost = true; // important tw.Topmost = false; // important tw.Focus(); // important } }