DataGridColumn
не является производным от FrameworkElement
или FrameworkContentElement
, поэтому его нет в визуальном дереве и не имеет DataContext
, поэтому ваша привязка не работает.
Если List<int>
, к которому вы привязываетесь, одинаково для каждого элемента, то, возможно, вам следует найти другой способ привязки к нему, возможно, вы можете сделать его статическим и использовать StaticResource
в Связывании.
В любом случае, чтобы связать ItemsSource
со свойством List<int>
в вашем исходном классе, вы можете использовать ElementStyle
и ElementEditingStyle
(как указано другими). Следующее должно работать
<DataGridComboBoxColumn Header="Number of Copies"
SelectedItemBinding="{Binding ListAreaItem}">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding LifeAreaList}"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding LifeAreaList}"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>