Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to convert the C# LongListSelectorSample from http://phone.codeplex.com/ to VisualBasic.

 

Here is the original C# code (with the problematic linq-query included):

       private void LoadLinqMovies()
       {
           List<Movie> movies = new List<Movie>();

           for (int i = 0; i < 50; ++i)
           {
               movies.Add(Movie.CreateRandom());
           }

           var moviesByCategory = from movie in movies
                                  group movie by movie.Category into c
                                  orderby c.Key
                                  select new PublicGrouping<string, Movie>(c);

           linqMovies.ItemsSource = moviesByCategory;
       }

 

And here is my VB attempt to populate the LongListSelector with grouped movie items:

   Private Sub LoadLinqMovies()
       Dim MovieList As New List(Of Movie)

       For i As Integer = 0 To 49
           MovieList.Add(Movie.CreateRandom())
       Next

       Dim MoviesByCategory = _
                      From OneMovie In MovieList _
                      Group OneMovie By Cat = OneMovie.Category _
                      Into GroupedMovies = Group _
                      Select New PublicGrouping(Of String, Movie)(GroupedMovies)

       Movies_LLS.ItemsSource = MoviesByCategory
   End Sub

Apparently something goes wrong with the linq query but what?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...