Bind a List to the ItemsSource of the DataGridComboBoxColumn and then specify the SelectedItemBinding, DisplayMemberPath, SelectedValueBinding or the SelectedValuePath property.
Below is sample code from social.msdn site:
XAML:
<DataGrid AutoGenerateColumns="False" Height="200" HorizontalAlignment="Left" Name="dataGrid1" VerticalAlignment="Top" Width="308">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Name}"/>
<DataGridComboBoxColumn x:Name="ComboBoxColumn" Header="Position" SelectedItemBinding="{Binding Position}"/>
</DataGrid.Columns>
</DataGrid>
Code:
public partial class MainWindow : Window
{
public ObservableCollection<Player> Players { get; set; }
public ObservableCollection<string> Positions { get; set; }
public MainWindow()
{
Positions = new ObservableCollection<string>() { "Forward", "Defense", "Goalie" };
Players = new ObservableCollection<Player>(){
new Player() {Name = "Tom",Position= "Forward"},
new Player() {Name = "Dick", Position= "Defense"},
new Player() {Name = "Harry", Position= "Goalie"}
};
InitializeComponent();
ComboBoxColumn.ItemsSource = Positions;
dataGrid1.ItemsSource = Players;
}
}
public class Player
{
public string Name { set; get; }
public string Position { set; get; }
}