Binding ComboBox inside ListView problem
I am attempting to put a bound ComboBox into my ListView. However, I can not get it to bind correctly. All of the textboxes that are in the ListView bind without any issues, but the ComboBox has issues. I am binding to the DefaultView of a DataTable in the code-behind. I have verified that the field that I am trying to bind to exists, as I tested by putting a TextBox in place of the ComboBox when I initially created the ListView. Thanks in advance for any tips.
-----
The following line of code is what does the binding.
-----
child.ItemsSource = customBusinessProcessTables.Tables["process_rule_input_val"].DefaultView;
----
The following is the listview that I am attempting to bind to.
----
<ListView Margin ="0,20,0,0" x:Name="_processruleinputvalList" HorizontalAlignment="Left" Width="Auto" Height="120">
<ListView.View>
<GridView>
<GridViewColumn Header="Name" Width="300">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Label Content="{Binding Path=table_and_field}" VerticalContentAlignment="Center"></Label>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Operator" Width="55">
<GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox Name="mycombo" SelectedItem="{Binding Path=operator, Mode=TwoWay}" Width = "50">
<ComboBoxItem Content=""></ComboBoxItem>
<ComboBoxItem>EQ</ComboBoxItem>
<ComboBoxItem>NE</ComboBoxItem>
<ComboBoxItem>CH</ComboBoxItem>
<ComboBoxItem>GE</ComboBoxItem>
<ComboBoxItem>LE</ComboBoxItem>
</ComboBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Value" Width="300">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Name="tbListLabelValue" IsReadOnly="False" TextWrapping="WrapWithOverflow" Width = "300" Text="{Binding Path=value}" VerticalContentAlignment="Center">
</TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Created By" Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Name="tbListLabelValue" IsReadOnly="False" TextWrapping="WrapWithOverflow" Width = "100" Text="{Binding Path=created_by}" VerticalContentAlignment="Center">
</TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Created Date" Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Name="tbListLabelValue" IsReadOnly="False" TextWrapping="WrapWithOverflow" Width = "100" Text="{Binding Path=created_dttm}" VerticalContentAlignment="Center">
</TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
|