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

Item Unrealized or Scrolled

5 Answers 30 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Olu
Top achievements
Rank 1
Olu asked on 14 Feb 2014, 05:07 PM
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.

5 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 17 Feb 2014, 08:35 AM
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.
0
Olu
Top achievements
Rank 1
answered on 17 Feb 2014, 02:44 PM
Hi,

Thanks for that.

How can I attach to this event from a DataTemplate declared in ResourceDictionary?
0
Deyan
Telerik team
answered on 17 Feb 2014, 03:57 PM
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.
0
Nguyen
Top achievements
Rank 1
answered on 03 Oct 2014, 04:32 AM
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 ???? 
0
Tsvyatko
Telerik team
answered on 07 Oct 2014, 06:48 AM
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.

 
Tags
DataBoundListBox
Asked by
Olu
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Olu
Top achievements
Rank 1
Nguyen
Top achievements
Rank 1
Tsvyatko
Telerik team
Share this question
or