Problems with disposing User Controls

3 posts, 1 answers
  1. Akshay
    Akshay avatar
    11 posts
    Member since:
    Mar 2012

    Posted 31 Mar 2012 Link to this post


    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;
    .Content  = null; But the object still lives in the memory, any pointers please?
  2. Answer
    Miro Miroslavov
    Miro Miroslavov avatar
    588 posts

    Posted 04 Apr 2012 Link to this post

    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. 

    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 >>
  3. Akshay
    Akshay avatar
    11 posts
    Member since:
    Mar 2012

    Posted 18 Jun 2012 Link to this post

    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.
Back to Top