I have this XAML that selects a value from a combobox that the ItemSource is a Enum. The tutorial I used is:
http://www.c-sharpcorner.com/uploadfile/dpatra/combobox-in-datagrid-in-wpf/
<DataGrid x:Name="dgProductItem"
ItemsSource="{Binding ProductVersion.ProductItems}"
<DataGridTemplateColumn Header="Deployment Type" Width="120">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding DeploymentType}"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Source={StaticResource DeploymentTypeEnum}}"
SelectedItem="{Binding DeploymentType}">
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
However when I change a value from one row, it will update all the rows. Does anyone know why this is?
Edit:
if I just change one row, it will only update that row, but when I go to change a different row, that row I just changed will also change the previous one..
Cheers
DeploymentType
is almost certainly singular, but you are using it for every row in theDataGrid
. Yourenum
property needs to be in the class that each item in theDataGrid
belongs to. – Hetaeraenum
value that is shared between all of the items... you just need to find it. – HetaeraDeploymentType
property defined?... I'm guessing that's not in your item class. – Hetaera