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

Change looping list item image at runtime

5 Answers 115 Views
LoopingList
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gian Paolo Santopaolo
Top achievements
Rank 1
Gian Paolo Santopaolo asked on 07 Mar 2013, 12:38 PM
Dear Telerik
    I'm using your fabolous looping list for WP8.
Let's take your Orientation sample in LoopingList folder ( Examples_WP). What I'm trying to reach is to change the image of the selected item at rutime:
eg. something happens to the collection I "bind" to your LoopingListDataSource then I want to change the image of the selected item.
Can you help me with a sipped of code?

regards
-g

5 Answers, 1 is accepted

Sort by
0
Gian Paolo Santopaolo
Top achievements
Rank 1
answered on 08 Mar 2013, 08:50 AM
Dear Telerik Team
     any update about that?

regards
-g
0
Deyan
Telerik team
answered on 11 Mar 2013, 08:29 AM
Hello Gian Paolo,

Just handle the SelectedIndexChanged event, take the selected data item and change the URI of the image it provides. If you correctly implement the INotifyPropertyChanged event the change should be reflected in the control.

Kind regards,
Deyan
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
Gian Paolo Santopaolo
Top achievements
Rank 1
answered on 12 Mar 2013, 09:48 AM
Hi Deyan
    unfortunately the selectedindexchanged doesn't fire but the list moves itself.
Here is a sample project reproducing the issue http://sdrv.ms/Y6EeKt.
Keep in mind that this is an extraction of a real word project where the data are stored in the cloud so all is asynchronous and when I save something the looping items have to be reloaded .

thanks in advice!
    
0
Accepted
Deyan
Telerik team
answered on 14 Mar 2013, 08:56 AM
Hi Gian Paolo,

I have taken a look at your code and I think for the purposes you have right now you're taking a rather complex path :).

I am assuming you want to update the image of the selected item. Since you've already a special PictureLoopingItem which has a Picture URI property which fires the PropertyChanged event when updated, you need to handle the SelectedIndexChanged event (which btw works on my side) and update the URI property of the currently selected item with the URI of the new picture.

You do not need to manually subscribe for PropertyChanged events on your ViewModel etc, this is done automatically by the Silverlight framework.

The logic that you have put in the ItemUpdated event:

if (count == ((MainViewModel)DataContext).Persons.Count && firstRun == true)
           {
               this.loopingList.SelectedIndexChanged += LoopingListSelectedIndexChanged;
               this.loopingList.SelectedIndex = 0;
               firstRun = false;
 
           }
 
           if (firstRun == true)
               count++;

is also not at the right place. You can easily subscribe for the SelectedIndexChanged event in XAML.

So, since I am still not quite sure that I correctly understand what you're trying to achieve, I would like to ask you for some further details and I will try to modify your project accordingly.

Greetings,
Deyan
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
Gian Paolo Santopaolo
Top achievements
Rank 1
answered on 14 Mar 2013, 10:05 AM
Never mind I solved the issue, I here is the working solution http://sdrv.ms/WpbVX8.
Btw looping list is a great control !

-g

Tags
LoopingList
Asked by
Gian Paolo Santopaolo
Top achievements
Rank 1
Answers by
Gian Paolo Santopaolo
Top achievements
Rank 1
Deyan
Telerik team
Share this question
or