private void ResultControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { ResultDetail current = (sender as TabControl).SelectedItem as ResultDetail; if (e.OriginalSource != FindName("ResultControl")) { return; } if (current == null || !current.CanBeEdited) // can be edited for show only { return; } current.CreateNewForm(); }