private void EditButton_Click(object sender, RoutedEventArgs e) { ListViewView listView = FocusedTabControl.SelectedContent as ListViewView; TreeListView treeListView = FocusedTabControl.SelectedContent as TreeListView; if (listView != null) { listView.Edit(); } else { treeListView.Edit(); } RefreshTabs(); }