Item Unrealized or Scrolled

6 posts, 0 answers
  1. Olu
    Olu avatar
    10 posts
    Member since:
    Dec 2010

    Posted 14 Feb 2014 Link to this post

    I have a RadDataboundListbox with lots if images, when I scroll and the item is taken off view, I want to release the image resource (dispose) ... is there any event fired when item is no longer in view or what is the best way to dispose off images scrolled off view?

    I want to do this mainly because I notice as I keep scrolling for more images used memory keep growing and even though I havn't got a OOM yet, I believe at some point I will.

    Thanks.
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 17 Feb 2014 Link to this post

    Hi Olu,

    Thanks for writing and for your question.

    There is the ItemStateChanged event exposed by RadDataBoundListBox which you can use to understand when a visual items goes into one of the following states:

    - Being realized
    - Realized
    - Being recycled
    - Recycled

    You can find information about the state in the event arguments provided to the handler method.

    You can use this method to free the image resources.

    Regards,
    Deyan
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
  3. DevCraft banner
  4. Olu
    Olu avatar
    10 posts
    Member since:
    Dec 2010

    Posted 17 Feb 2014 in reply to Deyan Link to this post

    Hi,

    Thanks for that.

    How can I attach to this event from a DataTemplate declared in ResourceDictionary?
  5. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 17 Feb 2014 Link to this post

    Hi Olu,

    Thanks for writing.

    Can you please share some more details on your scenario? You can subscribe for events within XAML code but if this is a style in a dictionary, that would not be possible. In such case you will need to programatically access the corresponding control that fires the event and access it.

    Regards,
    Deyan
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
  6. Nguyen
    Nguyen avatar
    5 posts
    Member since:
    Aug 2014

    Posted 02 Oct 2014 Link to this post

    Hi, 
    I have a problem with ItemStateChanged event, I need to get FrameworkElement or UIElement which is Realize or Recycled. 
    Could you please help me that ???? 
  7. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 07 Oct 2014 Link to this post

    Hello Nguyen,

    Generally, modifying UI containers in virtualization scenarios could lead to performance issues as well as unexpected results. Would it be possible to elaborate more on the scenario you are trying to achieve in order to suggest optimal solution.

    Regards,
    Tsvyatko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft banner