private void OpenCommand_Executed(object sender, ExecutedRoutedEventArgs e) { // Ask to save project if changes were made SaveChanges(); // setup the open dialog OpenFileDialog openFile = new OpenFileDialog { Title = "Open", Filter = weaponDesignerFiles, InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) }; if (openFile.ShowDialog() == true) { if (weaponlistLoader.Load(openFile.FileName) != true) { MessageBox.Show("Unable to open selected project file.", "Format Error"); } else { // Set the displayed project save and keep the path for Save tbProjectTitle.Text = openFile.SafeFileName; tbProjectTitle.FontStyle = FontStyles.Normal; projectPath = openFile.FileName; canSave = true; Update(); // Re-sort loaded project contents by category ICollectionView view = CollectionViewSource.GetDefaultView(dgWeaponList.ItemsSource); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("eCategory", ListSortDirection.Ascending)); view.Refresh(); } } }