Move Carousel item to front

6 posts, 0 answers
  1. Kevin
    Kevin avatar
    14 posts
    Member since:
    Jul 2012

    Posted 13 Jun 2012 Link to this post

    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
  2. Kevin
    Kevin avatar
    14 posts
    Member since:
    Jul 2012

    Posted 15 Jun 2012 Link to this post

    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?
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 18 Jun 2012 Link to this post

    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 >>
  5. Kevin
    Kevin avatar
    14 posts
    Member since:
    Jul 2012

    Posted 18 Jun 2012 Link to this post

    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 :)
  6. Kevin
    Kevin avatar
    14 posts
    Member since:
    Jul 2012

    Posted 18 Jun 2012 Link to this post

    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
  7. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 21 Jun 2012 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready