I have made a Dashboard using Telerik RadtileView and inside TileViewItems, I am placing my User Controls dynamically.
I am using MEF here and the Dashboard is in a different project and UserControls are in a different project altogether.
I am using EventAggregators to convey the events.
Now when I want to close my dashboard Tile View Item, I also want to dispose the UserControl and the DataContext associated with it.
I tried using the method below:
RadTileViewItem tileViewItem = (sender as Button).ParentOfType<RadTileViewItem>();
UserControl userControl = tileViewItem.Content as UserControl;
(tileViewItem.Content as UserControl).DataContext = null;
tileViewItem.Content = null;
But the object still lives in the memory, any pointers please?