wpf DataGrid.datagridtemplatecolumn combobox does not update itemssource

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-06-18T16:04:16Z Indexed on 2010/06/18 16:13 UTC
Read the original article Hit count: 1253

Filed under:
|
<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?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about wpfdatagrid