private void Button_Click2(object sender, RoutedEventArgs e) { var dialog = new VistaOpenFileDialog() { CheckPathExists = true, AddExtension = true, Filter = "XML File (*.xml)|*.xml", }; dialog.ShowDialog(); if ((dialog.FileName != null) && (dialog.FileName != "")) { var window = new PropertyEditor(); ObservableCollection <PropertyGroup> read = PropertyCreator.Read_File(dialog.FileName); foreach (PropertyGroup group in read) { foreach (PropertyGroup item in PropertyEditor.Convert(group).PropertyGroups) { window.PropertyGroups.Add(item); } } window.ShowDialog(); if (window.Result != WindowDictionary.Resources.DialogResult.Yes) { return; } _ = window.PropertyGroups; } }