private void SerializeBoW_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.Filter = "XML Files (.xml)|*.xml"; Nullable <bool> result = dlg.ShowDialog(); if (result == true) { string fileName = dlg.FileName; try { SerializationClass.ConSerializer(bow, fileName); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Failed to save File"); } }