我可以使用以下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