I have a pivot control with dynamicaly generated items, pointing to a list of objects.
The pivot i开发者_如何转开发tem template contains an image control that is bound to Uri property in the objects provided.
here is the line from the pivot item template:
<Image Source="{Binding ImageUri}" Height="660" Width="460"/>
I discovered i need to access the Image control inside the generated pivot items, so i can explicitly set its source to null after i use it, otherwise it will not free the memory and the app exceeds the 90 mb requirement.
So for a given pivot index, how can i reference the Image control inside the pivot item?
Give it a name in the template and then use PivotItem.FindName(string name)
to find the Image
control. You can preform an explicit type cast for the object returned, so it will be an actual Image
control where you can manipulate the contents.
Although I think that there are major optimization problems on some other end if your images (in app) are taking 90+ MB of memory.
I handled the "Unloading" event of the image, and used it to set the source to null.
精彩评论