Listbox that when you reach the end it goes back to the beginning

Posted by Roy on Stack Overflow See other posts from Stack Overflow or by Roy
Published on 2010-06-08T04:01:42Z Indexed on 2010/06/08 4:12 UTC
Read the original article Hit count: 220

Filed under:
|

Hi, Is there a way to make a Listbox go back to the beginning of the list once a user scrolls all the way to the end of list?

Current aspx code:

<ListBox x:Name="listbox">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <Image Name="imgSource" Source="{Binding Path=Url}" />
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Current code behind code:

public class ImageScroller
{
    public string Url { get; set; }
}

public MainPage()
{
    InitializeComponent();
    LoadImages();
}

void LoadImages()
{
    listbox.ItemsSource = new List<ImageScroller> 
                                    { 
                                        new ImageScroller 
                                        { 
                                            Url = "images/Chrysanthemum.jpg" 
                                        },
                                        new ImageScroller 
                                        { 
                                            Url = "images/Desert.jpg" 
                                        },
                                        new ImageScroller 
                                        { 
                                            Url = "images/Hydrangeas.jpg" 
                                        },

                                    };
}

Thanks for your help!

© Stack Overflow or respective owner

Related posts about c#

Related posts about listbox