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

RadSlideView ImageFailed

1 Answer 58 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.
Derek
Top achievements
Rank 1
Derek asked on 14 Nov 2012, 05:23 PM
Using a RadSlideView with an ItemTemplate that contains a PanAndZoomImage, what would you recommend as the best way to handle the ImageFailedEvent and display a different image when this event fires?

I've tried a couple different things:

I've tried having a Image and PanAndZoomImage element in the template and binding the Visibility to IsFailedImage for both, one having an Inverse property passed to the converter, so if the ImageFailedEvent fires I set IsFailedImage and the Image element is visible, if IsFailedImage is false the PandAndZoomImage will be visible.  In theory this should work but when IsFailedImage is true, the screen is blank.

I've also tried changing the PandAndZoomImage Source after ImageFailed fires but again, the ImageFailed image won't display.

I've thought about using a TemplateSelector but I'm not sure that would work as ImageFailed would be firing in one of the template selections.

Am I missing something?  It would be nice to have something built in for this, similar to the DataboundListbox display a message when there isn't any data to display.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Lance
Top achievements
Rank 2
answered on 14 Nov 2012, 06:18 PM
Hi Derek,

You could place a Border above the SlideView in the Visual Tree on that page. Inside the Border have a textblock with something like "We're sorry, there was a problem getting the image. Slide to the next image"

Then tie the visibility of the Border to whether or not an image loaded similar to what you already attempted. You shouldn't need to tie in the visibility of the PanAndZoomImage. That way you have a completely independent item in the tree that collapses and shows itself according to your IsFailedImage property

Also, if you are using MVVM, you will need a BooleanToVisibility converter, as Visibility isnt a bindable property.

If I misunderstood the question or if you'd like a sample converter, let me know. I'm more than happy to oblige.

Good Luck,
Lancelot
Tags
SlideView
Asked by
Derek
Top achievements
Rank 1
Answers by
Lance
Top achievements
Rank 2
Share this question
or