title: Need simple example of WPF binding Objects to Listbox with LINQ
body: <p>The following example successfully binds objects with a <code>ListBox</code> to display them.
  However, I would like to create all the objects in one class and then from another class query them with LINQ to fill my XAML <code>ListBox</code>, what would I need to add this example:</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication15.Window1"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="Window1" Height="300" Width="300"
          xmlns:local="clr-namespace:WpfApplication15"&gt;
      &lt;Window.Resources&gt;
          &lt;ObjectDataProvider x:Key="customers" ObjectType="{x:Type local:Customers}"/&gt;
          &lt;DataTemplate x:Key="LastNameFirst" DataType="WpfApplication15.Customer"&gt;
              &lt;StackPanel Margin="10 10 10 0" Orientation="Horizontal"&gt;
                  &lt;TextBlock Text="{Binding Path=LastName}" FontWeight="bold"/&gt;
                  &lt;TextBlock Text=", "/&gt;
                  &lt;TextBlock Text="{Binding Path=FirstName}"/&gt;
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/Window.Resources&gt;
      &lt;Grid&gt;
          &lt;ListBox ItemsSource="{Binding Source={StaticResource customers}}"
                   ItemTemplate="{StaticResource LastNameFirst}"/&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Code behind:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Data;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Imaging;
  using System.Windows.Navigation;
  using System.Windows.Shapes;
  
  namespace WpfApplication15
  {
      public partial class Window1 : Window
      {
          public Window1()
          {
              InitializeComponent();
          }
      }
  
      public class Customer
      {
          public string FirstName { get; set; }
          public string LastName { get; set; }
  
          public Customer(string firstName, string lastName)
          {
              this.FirstName = firstName;
              this.LastName = lastName;
          }
      }
  
      public class Customers : List&lt;Customer&gt;
      {
          public Customers()
          {
              this.Add(new Customer("Jim", "Thompson"));
              this.Add(new Customer("Julie", "Watson"));
              this.Add(new Customer("John", "Walton"));
          }
      }
  }
  </code></pre>