我可以使用以下Xmal位的组合框添加到DataGrid:在Silverlight中添加一个组合框到DataGrid
<local:DataGridTemplateColumn Header="SomeHeader" Width="106" HeaderStyle="{StaticResource headerAlignRightStyle}" CellStyle="{StaticResource cellAlignRightStyle}">
<local:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding SomeProp}" Margin="4"/>
</DataTemplate>
</local:DataGridTemplateColumn.CellTemplate>
<local:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox
x:Name="SomeCombo"
SelectionChanged="SomeCombo_SelectionChanged"
ItemsSource="{Binding SomeList}"
DisplayMemberPath="Name"
/>
</DataTemplate>
</local:DataGridTemplateColumn.CellEditingTemplate>
</local:DataGridTemplateColumn>
但我想不出是一个明智的方式来获得,这是COMBOX是行 必然。即当处理组合框SelectionChanged事件时,我无法知道哪些组合框属于哪个组合框。特别是我不知道该组合框引用的DataGrid数据源 中有什么对象。
任何帮助将不胜感激。
谢谢 - 我现在寻找到正确MVVM ... – bplus 2010-05-26 20:27:12