views:

48

answers:

0
<Grid Loaded="Grid_Loaded">
<DataGrid Margin="10,10,10,162" x:Name="dataGrid1" ItemsSource="{Binding myItemsSource}"/>      
<DataGrid Margin="10,164,10,10" x:Name="dataGrid2" ItemsSource="{Binding myItemsSource}" AutoGenerateColumns="False">
  <DataGrid.Columns>
    <DataGridTextColumn Header="A" Binding="{Binding A}"></DataGridTextColumn>
    <DataGridComboBoxColumn Header="B" TextBinding="{Binding B}" x:Name="columnB"></DataGridComboBoxColumn>
    <DataGridTemplateColumn Header="C" x:Name="columnC">
      <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
          <ComboBox Text="{Binding C, Mode=TwoWay}" SelectedItem="{Binding C, Mode=TwoWay}">
            <ComboBoxItem Content="AAA"/>
            <ComboBoxItem Content="BBB"/>
            <ComboBoxItem Content="CCC"/>
            <ComboBoxItem Content="XXX"/>
            <ComboBoxItem Content="YYY"/>
            <ComboBoxItem Content="ZZZ"/>
          </ComboBox>
        </DataTemplate>
      </DataGridTemplateColumn.CellTemplate>
    </DataGridTemplateColumn>
  </DataGrid.Columns>
</DataGrid>

columnB (buidin DataGridComboBoxColumn) is working. columnB.ItemsSource = LstForCbx; public List LstForCbx = new List{"AAA", "BBB", "CCC", "XXX", "YYY", "ZZZ"};

columnC combobox in DataGridComboBoxColumn not working. What wrong with my code?