A memory leak occurs in the RadTreeView control used for the table of contents in the RadPdfViewerNavigationPane, when changing the DocumentSource of RadPdfViewer at runtime.
To work this around, you can get the RadTreeView used by RadPdfViewerNavigationPane and manually clear its internal item storage before assigning the new DocumentSource.
private void ReloadDocument()
{
var navigationPane = this.pdfViewerNavigationPane;
var navigationPaneTreeView = navigationPane.FindChildByType<RadTreeView>();
if (navigationPaneTreeView != null)
{
object itemStorage = typeof(RadTreeView)
.GetProperty("ItemStorage", BindingFlags.Instance | BindingFlags.NonPublic)
.GetValue(navigationPaneTreeView);
MethodInfo itemStorageClearMethod = itemStorage.GetType().GetMethod("Clear", BindingFlags.Instance | BindingFlags.NonPublic);
itemStorageClearMethod.Invoke(itemStorage, null);
}
this.DocumentSource = theNewDocumentSource;
}