We are using WPF with Prism, MEF, and Telerik controls (PdfViewer and GridView, version 2017.2.503.45). Our application loads multiple tab views dynamically using the MVVM pattern. Each view contains multiple Telerik controls, and their data is bound from the ViewModel.
The issue we are facing is that when a tab is closed, the Telerik controls still hold references to the associated ViewModel, preventing the memory from being released.
We have tried the following approaches while closing the tab:
RadPdfViewer.DataContext = null;
RadPdfViewer = null;
RadGridView.DataContext = null;
RadGridView = null;
We also tried disposing of the Telerik controls, but the memory is still retained by them.
We have also defined the PdfViewer in XAML, but no PDF file was ever loaded into it from the UI. However, even in this case, the XAML view is not being disposed when the tab is closed, and the PdfViewer still holds a reference to the view.
Could you please help us identify how to properly release memory and ensure the controls?