I have a Datagrid that uses a DataGridComboBoxColumn to edit cell values. When I edit a cell, the ComboBox appears as expected, and I can use the mouse to display the dropdown. But when I use the mouse to click on one of the dropdown items, the dropdown disappears, no change is made to the SelectedItem, and the mouse click is instead processed by the Datagrid (i.e, the row behind the dropdown gets selected.)
However, if I mouse to the item from the dropdown and, rather than clicking, hit enter instead, then the ComboBox selection changes as expected. Also, since this particular column is the rightmost in the DataGrid, if I mouse to an item and click on a portion of the dropdown that is outside of the DataGrid, then the selection changes as expected.
Here is a snippet of the XAML for the DataGrid:
<DataGrid
x:Name="Criteria"
Grid.Row="1" Grid.Column="0"
AutoGenerateColumns="False"
ItemsSource="{Binding OrderedCriteria}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type GroupBox}}}"
ColumnWidth="*"
CanUserAddRows="True"
CanUserDeleteRows="True"
CanUserSortColumns="False"
CanUserReorderColumns="False"
SelectionMode="Extended"
AllowDrop="True" >
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Name,Mode=OneWay}"/>
<DataGridTextColumn Header="Description" Binding="{Binding Description,Mode=TwoWay}" />
<DataGridTextColumn Header="Weight" Binding="{Binding Weight,Mode=OneWay}" />
<DataGridComboBoxColumn Header="Relation To Next"
ItemsSource="{StaticResource OrderingRelationStrings}"
DisplayMemberPath="{Binding Path=CriterionOrdering.Relation,Converter={local:OrderingRelationToStringConverter}}"
SelectedValueBinding="{Binding Path=CriterionOrdering.Relation,Mode=TwoWay,Converter={local:OrderingRelationToStringConverter}}"/>
</DataGrid.Columns>
</DataGrid>
If anyone can tell me how to correct this odd behavior, I would greatly appreciate it.