private void LoadDocument(DocumentReference document) { if (dbTrans != null) { dbTrans.Rollback(); dbTrans.Dispose(); } if (document.Collection is FileCollectionReference) { var fileInfo = (document.Collection as FileCollectionReference).GetFileObject(document); GroupFile.Visibility = Visibility.Visible; FileView.LoadFile(fileInfo); } currentDocument = document.Collection.LiteCollection.FindById(document.LiteDocument["_id"]); documentReference = document; dbTrans = documentReference.Collection.Database.LiteDatabase.BeginTrans(); customControls = new ObservableCollection <DocumentFieldData>(); for (int i = 0; i < document.LiteDocument.Keys.Count; i++) { var key = document.LiteDocument.Keys.ElementAt(i); customControls.Add(NewField(key, IsReadOnly)); } ListItems.ItemsSource = customControls; }