title: Writing .txt file on ListBox
body: <p>I'm to write out a text file in a ListBox, but all I'm getting is a list "BabyName". My code looks like this:</p>
  
  <pre><code>public partial class MainWindow : Window
  {
      public MainWindow()
      {
          InitializeComponent();
      }
  
      public void FirstDecadeTopNames_Loaded(object sender, RoutedEventArgs e)
      {
          FileStream fs = new FileStream(@"D:\Dokumenter\Skole\6. semester\GUI\Exercises\Exercise4\WpfApplication1\04-babynames.txt", FileMode.Open);
          StreamReader sr = new StreamReader(fs, Encoding.Default);
          List&lt;BabyName&gt; babyNames = new List&lt;BabyName&gt;();
  
          while (!sr.EndOfStream)
          {
              BabyName name = new BabyName(sr.ReadLine());
              babyNames.Add(name);
              FirstDecadeTopNames.Items.Add(name);
          }
      }
  }
  </code></pre>
  
  <p>I assume I'm not putting the StreamReader into my list, but I can't see where I'm doing it wrong.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Here's the XAML for the ListBox:</p>
  
  <pre><code>&lt;ListBox Name="FirstDecadeTopNames"
           Margin="10"
           Loaded="FirstDecadeTopNames_Loaded" &gt;
  &lt;/ListBox&gt;
  </code></pre>