title: c# adding items to combo box from database
body: <p>I want to  populate a combo box with items from my database i did this:</p>
  
  <pre><code> public partial class addAssoc : Window
  {
      private libraryDBEntities1 context;
      public addAssoc()
      {
          InitializeComponent();
      }
  
      private void Window_Loaded(object sender, RoutedEventArgs e)
      {
          context = new libraryDBEntities1();
          System.Windows.Data.CollectionViewSource libraryDBEntities1ViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("libraryDBEntities1ViewSource")));
          // Load data by setting the CollectionViewSource.Source property:
          // libraryDBEntities1ViewSource.Source = [generic data source]
  
          var q = from b in context.textbooks
                  select b.Title;
  
  
          foreach(var item in q){
              titleComboBox.Items.Add(item);
  
          }
      }
  }
  }
  </code></pre>
  
  <p>which seems like its partially working, i am able to hover over the items in combo box, and they get highlighted, but they don't have the text. What is the reason for this? Any help would be greatly appreciated. I am using wpf</p>
  
  <pre><code> &lt;ComboBox x:Name="titleComboBox" Width="120" VerticalAlignment="Center" Grid.Row="0" Margin="3" ItemsSource="{Binding}" Height="Auto" HorizontalAlignment="Left" DisplayMemberPath="Title" Grid.Column="1"&gt;
  </code></pre>