This is a migrated thread and some comments may be shown as answers.

Problems with disposing User Controls

2 Answers 104 Views
TileView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Akshay
Top achievements
Rank 1
Akshay asked on 31 Mar 2012, 08:34 PM

Hi

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>();                
this.rtvDashBoard.Items.Remove(tileViewItem);
               
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?

2 Answers, 1 is accepted

Sort by
0
Accepted
Miro Miroslavov
Telerik team
answered on 04 Apr 2012, 08:48 AM
Hello Akshay,

 We don't have any known Memory leak in the TileView. Can you try your sample with a memory profiler and check what is causing the problem. You can try with our Just Trace profiler. It can lead you to the problem. 

Greetings,
Miro Miroslavov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Akshay
Top achievements
Rank 1
answered on 18 Jun 2012, 12:43 PM
Hi sorry for late reply.
I got the solution to my problem, it was due to active events & event handlers. Made a method dispose to remove/unsubscribe those.
Tags
TileView
Asked by
Akshay
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
Akshay
Top achievements
Rank 1
Share this question
or