编辑:发帖后我意识到我在绑定中犯了一个简单的错误。解决。
我有一个由以下XAML定义的GridViewColumn:
...
<GridViewColumn Width="120">
<GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Path=extensions, RelativeSource={RelativeSource AncestorType=Window}}"
Width="105" IsEditable="True" HorizontalAlignment="Center" Margin="0,0,0,0" BorderThickness="0"
SelectedItem="{Binding Path=selectedExtension, Mode=TwoWay}">
<ComboBox.Resources>
<sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">15</sys:Double>
</ComboBox.Resources>
</ComboBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
...
无论如何,正确使SelectedItem绑定功能无效。是否可以遍历ComboBox并只手动设置SelectedItem?