سؤال

I converted an XpsDocument to FixedDocumentSequence (in a converter) using myXpsDocument.GetFixedDocumentSequence(); method .

Now I need the XpsDocument.Uri in code behind to release its file lock :

System.IO.Packaging.PackageStore.GetPackage(xpsUri).Close();
System.IO.Packaging.PackageStore.RemovePackage(xpsUri);

And problem is : How can I access the XpsDocument (or its Uri) in Code behind.

هل كانت مفيدة؟

المحلول

Instead of disposing it from code behind, you should dispose it as soon as you get it converted to FixedDocumentSequence may be inside converter only since no need to hold onto it once it gets converted to fixed document sequence.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top