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

Application crashes when slide images

3 Answers 81 Views
SlideView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ripal Vyas
Top achievements
Rank 1
Ripal Vyas asked on 20 Apr 2013, 09:22 AM
Hello,

We have developed windows phone 8 app and in which we have provided sliding functionality of image with RadSlideView and PanAndZoomControl in DataTemplate.

We have functionality to add images to slide view after storing to isolated stored which is done on add button.

But the severe problem we are facing is, application crashes on sliding of image when we have more than 2 images in slideview.

We have used observable collection to bind item source of slide view.

Thanks

3 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 24 Apr 2013, 08:25 AM
Hi Ripal,

Thank you for contacting us.

We have used RadSlideView in scenarios that include a lot more than two images as you can see from our Examples solution without crushing the application. As you may know the applications in windows phone have memory limits for the resources that they use and if you store images in the memory, you can quickly run out of resources. You can see our examples for RadSlideView, part of the Examples solution, usually located at C:\Program Files (x86)\Telerik\RadControls for Windows Phone [Version]\Examples to see examples of the best usages of RadSlideView. You can also go to the downloads section of your account and see our PictureGallery example, which also demonstrates how to implement some basic image viewing scenarios.

I hope this information helps. If you need additional assistance, you can submit a support ticket and attach your solution (or a sample version that demonstrates your issue) so that we can assist you better for you specific scenario.

Regards,
Todor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Hung
Top achievements
Rank 1
answered on 22 Sep 2013, 02:55 PM
Hi, I have the same issue when loading images isolated storage and binding to RadSlideView. The application crashed because of OutOfMemory exception when there were a lot of image or when I slide between 2 images a lot of time. I think the problem happens because the GC collector of Windows Phone doesn't do its work to clean up the image data when displayed item changes. I try to do some clean up by my self, but can't find the same event like VirtualizingStackPanel.CleanupVirtualizedItemEvent (which used for ListBox conrol) to call the dippose.
As the admin mentioned above, I go review the sample code from Telerik for SlideView and still dont find anything helpful. The sample code also do not implement clean up but it still work without making the app crash. I dont know why but It make me no surprise since the sample code always work without any problem which is faced by other devs (for example, I have to add the CacheMode="BitmapCache" to avoid the flicker happen when slide to next/previous item, but the sample code without that line works perfectly).
Below is my code for binding images from isolaed storage to RadSlideView. Hope anyone can help. Thanks.
[Table]
    public class Entry : INotifyPropertyChanged, INotifyPropertyChanging, IDisposable
    {
        private string _imgSrc;
        [Column]
        public string ImgSrc
        {
            get { return _imgSrc; }
            set
            {
                if (_imgSrc != value)
                {
                    NotifyPropertyChanging("ImgSrc");
                    _imgSrc = value;
                    NotifyPropertyChanged("ImgSrc");
                }
            }
        }
 
        [IgnoreDataMember]
        public BitmapImage Image
        {
            get
            {
                if (_imgSrc == null || _imgSrc.Equals(String.Empty))
                {
                    return null;
                }
 
                BitmapImage image = new BitmapImage();
                using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    if (isoStore.FileExists(_imgSrc))
                    {
                        var stream = isoStore.OpenFile(_imgSrc, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                        image.SetSource(stream);
                        stream.Close();
                        return image;
                    }
                }
 
                return null;
            }
        }
 
        #region notify event
        public event PropertyChangedEventHandler PropertyChanged;
        public void NotifyPropertyChanged(String propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
 
        public event PropertyChangingEventHandler PropertyChanging;
        private void NotifyPropertyChanging(string propertyName)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
            }
        }
        #endregion
 
        public void Dispose()
        {
             
        }
    }
<telerikPrimitives:RadSlideView x:Name="SlideView"
                                        TransitionMode="Slide"
                                        ItemsSource="{Binding Entries}"
                                        CacheMode="BitmapCache"
                                        IsLoopingEnabled="False"
                                        Orientation="Vertical"
                                        VirtualizingStackPanel.VirtualizationMode="Recycling">
            <telerikPrimitives:RadSlideView.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="1,5,1,5">
                        <Image Source="{Binding Path=Image}" Stretch="UniformToFill"/>
                    </Grid>
                </DataTemplate>
            </telerikPrimitives:RadSlideView.ItemTemplate>
        </telerikPrimitives:RadSlideView>

0
Todor
Telerik team
answered on 26 Sep 2013, 06:16 AM
Hello Hung,

Please have a look at this article, where the same issue is discussed.
 
Regards,
Todor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
SlideView
Asked by
Ripal Vyas
Top achievements
Rank 1
Answers by
Todor
Telerik team
Hung
Top achievements
Rank 1
Share this question
or