private void SaveNoteXaml(Note note) { Utilities.EnsureTargetFolderExists(_settingsService.Settings.NotesFileLocation); string noteFileName = GetNoteFileName(note.Id, _settingsService.Settings.NotesLocation); TextRange textRange = new TextRange(note.Document.ContentStart, note.Document.ContentEnd); using (FileStream fileStream = new FileStream(noteFileName, FileMode.Create)) { textRange.Save(fileStream, System.Windows.DataFormats.XamlPackage); } note.AcceptChanges(); // marked as saved }