I'm having a problem with my combo box and trying to get the text that is displayed in the box. I have the ItemsSource bound to a SqlDataReader, and I'm trying to populate another combo box based on what item is selected in the first combo box.
In the first combobox's selection changed event, I'm running a query based on what's selected in that box. However, I can't get that text for the life of me. Everything I've tried always returns "System.Data.Common.DataRecordInternal". Even when I try "comboBox.Text", it returns that also despite it not being displayed. Did I do the binding wrong? Or is something wrong with my item template for the combo box?
Here's the relevant code:
<ComboBox Name="cbTables" ItemsSource="{Binding ElementName=lstTables, Path=ItemsSource}"
SelectionChanged="cbTables_SelectionChanged" >
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding Path=TABLE_NAME}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Tell me if I need to post anything else. Thanks