JumpyNET
Centurion
- Joined
- Apr 4, 2005
- Messages
- 196
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):
And here is my VB attempt to populate the LongListSelector with grouped movie items:
Apparently something goes wrong with the linq query but what?
Here is the original C# code (with the problematic linq-query included):
Code:
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:
Code:
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