title: Longlistselector Wp7 binding a list inside a list of objects
body: <p>Hello i am having some issues with data binding in silverlight for wp7. Basically i have trouble binding a list that is inside another list of objects. Here is the example of my classes.</p>
  
  <pre><code>public class Movie
      {
  
          public Movie()
          {
              _Venues = new ObservableCollection&lt;Venue&gt;();
          }
  
          private String _Title;
  
          public String Title
          {
              get { return _Title; }
              set { _Title = value; }
          }
          private String _Director;
  
          public String Director
          {
              get { return _Director; }
              set { _Director = value; }
          }
          private String _Runtime;
  
          public String Runtime
          {
              get { return _Runtime; }
              set { _Runtime = value; }
          }
  
          private ObservableCollection&lt;Venue&gt; _Venues;
  
          public ObservableCollection&lt;Venue&gt; Venues
          {
              get { return _Venues; }
              set { _Venues = value; }
          }
  
  public class Venue
      {
          private String _Date;
  
          public String Date
          {
              get { return _Date; }
              set { _Date = value; }
          }
          private String _Time;
  
          public String Time
          {
              get { return _Time; }
              set { _Time = value; }
          }
      }
  }
  </code></pre>
  
  <p>My intention is to set a values from Venues in xaml:</p>
  
  <pre><code> &lt;!-- The template for movie items --&gt;
          &lt;DataTemplate x:Key="moviesItemTemplate"&gt;
              &lt;StackPanel Grid.Column="1"  VerticalAlignment="Top"&gt;
                  &lt;StackPanel Grid.Column="1"  VerticalAlignment="Top" Orientation="Horizontal"&gt;
                      &lt;Image delay:LowProfileImageLoader.UriSource="{Binding ImageThumb}"/&gt;
                      &lt;TextBlock Text="{Binding Title}" FontSize="26"  Margin="12,-12,12,6" HorizontalAlignment="Center" VerticalAlignment="Center" /&gt;
                  &lt;/StackPanel&gt;
                  &lt;ListBox ItemsSource="{Binding Venues}"&gt;
                      &lt;TextBlock Text="{Binding Date}" Foreground="Orange"  /&gt;
                  &lt;/ListBox&gt;
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
  
   &lt;!--ContentPanel contains details text. Place additional content here--&gt;
          &lt;Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"&gt;
              &lt;toolkit:LongListSelector x:Name="moviesListGropus" Background="Transparent" 
                   ItemTemplate="{StaticResource moviesItemTemplate}"
                   GroupHeaderTemplate="{StaticResource groupHeaderTemplate}"
                   GroupItemTemplate="{StaticResource groupItemTemplate}" &gt;   
                  &lt;toolkit:LongListSelector.GroupItemsPanel&gt;
                      &lt;ItemsPanelTemplate&gt;
                          &lt;toolkit:WrapPanel/&gt;
                      &lt;/ItemsPanelTemplate&gt;
                  &lt;/toolkit:LongListSelector.GroupItemsPanel&gt;
              &lt;/toolkit:LongListSelector&gt;
          &lt;/Grid&gt;
      &lt;/Grid&gt;
  </code></pre>
  
  <p>In cs code I used a manual loop to get movieGroups instead of a Linq expression but i think that should not be the problem here:</p>
  
  <pre><code>ObservableCollection&lt;Group&lt;Movie&gt;&gt; movieGroups = new ObservableCollection&lt;Group&lt;Movie&gt;&gt;();
  this.moviesListGropus.ItemsSource = movieGroups;
  
  public class Group&lt;T&gt; : IEnumerable&lt;T&gt;
          {
              public Group(string name, IEnumerable&lt;T&gt; items)
              {
                  this.Title = name;
                  this.Items = new List&lt;T&gt;(items);
              }
  
              public override bool Equals(object obj)
              {
                  Group&lt;T&gt; that = obj as Group&lt;T&gt;;
  
                  return (that != null) &amp;&amp; (this.Title.Equals(that.Title));
              }
  
              public string Title
              {
                  get;
                  set;
              }
  
              public IList&lt;T&gt; Items
              {
                  get;
                  set;
              }
  
              #region IEnumerable&lt;T&gt; Members
  
              public IEnumerator&lt;T&gt; GetEnumerator()
              {
                  return this.Items.GetEnumerator();
              }
  
              #endregion
  
              #region IEnumerable Members
  
              System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
              {
                  return this.Items.GetEnumerator();
              }
  
              #endregion
          }
  </code></pre>
  
  <p>Sadly i cannot provide an Image due to stackoverflows restrictions but the result can be seen on <a href="http://postimage.org/image/as49vtqvn/" rel="nofollow">http://postimage.org/image/as49vtqvn/</a></p>
  
  <p>EDIT 2nd part: The idea is to put another textBlock inside the template which would be responsible for showing the desired Time from the list of Venues. For that i need to go 1 level deeper because venues is a list and i want a specific object from that list. Any suggestions?</p>
  
  <pre><code> &lt;DataTemplate x:Key="moviesItemTemplate"&gt;
              &lt;StackPanel Grid.Column="1"  VerticalAlignment="Top"&gt;
                  &lt;StackPanel Grid.Column="1"  VerticalAlignment="Top" Orientation="Horizontal"&gt;
                      &lt;Image delay:LowProfileImageLoader.UriSource="{Binding ImageThumb}"/&gt;
                      &lt;TextBlock Text="{Binding Title}" FontSize="26"  Margin="12,-12,12,6" HorizontalAlignment="Center" VerticalAlignment="Center" /&gt;
                  &lt;/StackPanel&gt;
                  &lt;ItemsControl x:Name="venueTime" ItemsSource="{Binding Path= Venue}"&gt;
                      &lt;ItemsControl.ItemTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;TextBlock Text="{Binding Time}" Foreground="Orange" /&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/ItemsControl.ItemTemplate&gt;
                  &lt;/ItemsControl&gt;
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
  </code></pre>