我有一个
DataGrid
使用以下模板
<DataGridTemplateColumn Header="Priority" Width="60" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="comboPriority" SelectionChanged="DataGridComboBoxSelectionChanged" FontWeight="Bold" Loaded="comboPriority_Loaded">
<ComboBoxItem Background="Red">
<Label Background="Red" HorizontalContentAlignment="Center" Width="40">A</Label>
</ComboBoxItem>
<ComboBoxItem Background="#FFFFC000">
<Label Background="#FFFFC000" HorizontalContentAlignment="Center" Width="40">B</Label>
</ComboBoxItem>
<ComboBoxItem Background="Yellow">
<Label Background="Yellow" HorizontalContentAlignment="Center" Width="40">C</Label>
</ComboBoxItem>
<ComboBoxItem Background="#FF92D050">
<Label Background="#FF92D050" HorizontalContentAlignment="Center" Width="40">D</Label>
</ComboBoxItem>
<ComboBoxItem Background="#FF00B0F0">
<Label Background="#FF00B0F0" HorizontalContentAlignment="Center" Width="40">E</Label>
</ComboBoxItem>
<ComboBoxItem Background="#FFB1A0C7">
<Label Background="#FFB1A0C7" HorizontalContentAlignment="Center" Width="40">F </Label>
</ComboBoxItem>
<ComboBoxItem Background="#FFFF3399">
<Label Background="#FFFF3399" HorizontalContentAlignment="Center" Width="40">G</Label>
</ComboBoxItem>
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
我可以选择一个选项,将其保存到数据库中,并在初始加载时正确地看到所选的值。但是,当我滚动时,所选值在其他行上多次出现/消失。
作为一个例子。如果我从第一行的
ComboBox
,我在整个
数据网格
.
我试图在下拉选择之后刷新网格,但是
数据网格
表现也一样。