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

Move Carousel item to front

5 Answers 103 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 2
Kevin asked on 13 Jun 2012, 09:24 PM
Hi,

Ive incorperated your carousel into my application but im having some trouble. Based upon the user clicking a movie from the listview i generate and index in which i wish to use to bring the correct poster to the front of the carousel.

which methods should i be looking at for this?

i just want the carousel to move into the correct position just like when the user clicks on any other visible item.

Regards
Kevin

5 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 15 Jun 2012, 03:34 PM
Anything?

I mean, when you click on the carousel item it moves in to the central prosition, surely its the same call but you can specify the index of the item to move?

Ideas anyone?
0
Peter
Telerik team
answered on 18 Jun 2012, 06:16 AM
Hello Kevin,

Thank you for contacting Telerik support.

You should set the SelectedIndex property. Actually, the Carousel's Buttons manipulate exactly this property. For example this line of code will select the second item:
radCarousel1.SelectedIndex = 1

I hope this helps.

Regards,
Peter
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Kevin
Top achievements
Rank 2
answered on 18 Jun 2012, 11:40 AM
OMG simple, ill try this tonight.

I originally didnt think this would work because i tried before getting the .selectedIndex (clicking item) and it was giving me the wrong values. Values were not in sync ie 1,2,3,4,5, etc but 1,3.8,11 soi i gave up on it lol and i believe this to be a bug.

Thanks for the response, i will update you tomorrow if it works out :)
0
Kevin
Top achievements
Rank 2
answered on 18 Jun 2012, 08:16 PM
Hi, i completed the task to around 90%, i think i may have found a bug though.

I can sucessfully select the correct item in the carousel but im unable to select the 1st position (postion 0).
if i set index to 0 an error caught

Reported error:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"}

Dim index As Integer = 1
       While index <= Form1.directorylist.Count()
 
           Try
               'Get movie name from file path
               Dim temp As String = Form1.directorylist.Item(index)
               Dim tempName() As String = temp.Split("\")
               Dim movName = tempName(tempName.Count - 1)
 
 
               Form1.RadCarousel1.SelectedIndex = index
               'select item in carousel
               Dim selectedButton As RadButtonElement
               selectedButton = CType(Form1.RadCarousel1.SelectedItem, RadButtonElement)
 
               If Form1.directorylist(Form1.ListView20.Items.Item(Form1.ListView20.SelectedIndices(0)).Index).ToString.Contains(selectedButton.Text) Then
 
                   'UpdateRowSource name
                   ' Form1.RadCarousel1.SelectedIndex = index
                   Exit While
 
               End If
 
 
           Catch ex As Exception
 
           End Try
 
           index = index + 1
       End While

Can you confirm this is a bug and suggest a workaround or is the 1st item the last item ?

kevin
0
Peter
Telerik team
answered on 21 Jun 2012, 08:04 AM
Hi Kevin, 

Thank you for writing back.

I cannot confirm this as bug, because the SelectedIndex value must be between 0 and RadCorousel.Items.Count - 1. Can you please check how many items do you have in the RadCorousel.Items collection and ensure that you set the SelectedIndex in a valid range.

I hope this helps.

Regards,
Peter
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
Carousel
Asked by
Kevin
Top achievements
Rank 2
Answers by
Kevin
Top achievements
Rank 2
Peter
Telerik team
Share this question
or