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