Here is a xaml based solution of your problem;
1. XAML code:
<DataGridComboBoxColumn Header="Scores"
SelectedValueBinding="{Binding ScoreData, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{StaticResource ScoresAndDescription}"/>
<Setter Property="DisplayMemberPath" Value="Score"></Setter>
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{StaticResource ScoresAndDescription}"/>
<Setter Property="DisplayMemberPath" Value="ScoreVerbal"></Setter>
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle></DataGridComboBoxColumn>
When simpleDataGrid:ScoreData array is actually an array of your mapped objects. You can notice that the solution use two styles; one for the combo edit state (EditingElementStyle) when you select a value and the second (ElementStyle) for the state when the combo only displays selected value. Thus when the combpo is lost the focus on it, the score "Key" will be displayed, while you edit combo selected value (select value), the verbal score value will be displayed.
This solution requires the DataGridComboBoxColumn ItemsSource to be the collection of key/value pairs like this xaml code:
<x:Array Type="simpleDataGrid:ScoreData" x:key>
<simpleDataGrid:ScoreData Score="1" ScoreVerbal="the same"/>
<simpleDataGrid:ScoreData Score="3" ScoreVerbal="moderate superiority"/>
<simpleDataGrid:ScoreData Score="5" ScoreVerbal="strong superiority"/>
<simpleDataGrid:ScoreData Score="7" ScoreVerbal="the samvery strong superioritye"/>
<simpleDataGrid:ScoreData Score="9" ScoreVerbal="extremely superiority"/>
</x:Array>
Give me to know if you need the code behind version and not a XAML code.
I hope it will help, regards.
Update:
1. Column items source code (just set this in code behind):
private ObservableCollection<ScoreData> _scores = new ObservableCollection<ScoreData>(
new List<ScoreData>
{
new ScoreData{Score = 1, ScoreVerbal = "the same"},
new ScoreData{Score = 3, ScoreVerbal = "moderate superiority"},
new ScoreData{Score = 5, ScoreVerbal = "strong superiority"},
new ScoreData{Score = 7, ScoreVerbal = "the samvery strong superioritye"},
new ScoreData{Score = 9, ScoreVerbal = "extremely superiority"},
} );
2. ScoreData code:
public class ScoreData
{
public string ScoreVerbal { get; set; }
public int Score { get; set; }
}
Column creation code (set this as part of the column creation method):
var col = new DataGridComboBoxColumn();
dataGrid.Columns.Add(col);
col.Width = new DataGridLength(1, DataGridLengthUnitType.Star);
col.ItemsSource = _scores;
col.Header = "Added In Code";
col.SelectedValueBinding = new Binding("ScoreData");
//bring the ElementStyle from the xaml code by its key
var elementStyle = this.FindResource("ElementStyle") as Style;
col.ElementStyle = elementStyle;
//bring the EditingElementStyle from the xaml code by its key
var editingElementStyle = this.FindResource("EditingElementStyle") as Style;
col.EditingElementStyle = editingElementStyle;
Xaml code (set this as part of your window.xaml or app.xaml resources):
<Style x:Key="ElementStyle" TargetType="ComboBox">
<Setter Property="DisplayMemberPath" Value="Score"></Setter>
<Setter Property="IsReadOnly" Value="True"/>
</Style>
<Style x:Key="EditingElementStyle" TargetType="ComboBox">
<Setter Property="DisplayMemberPath" Value="ScoreVerbal"></Setter>
<Setter Property="IsReadOnly" Value="True"/>
</Style>
That's all, I will be glad to help if there will be problems with the code.
Regard.