2012-11-23 88 views
0

我想將Dictionary<string, ObservableCollection<string>>顯示到wpf數據網格中。 關鍵是列和值的列是這樣的行:使用DataGrid顯示和修改Dictionary <string,List <string>>

鍵1鍵2

Value1Key1 Value1Key2

Value2Key1 Value2Key2

Value3Key1 Value3Key2

我希望能夠要顯示,修改列和行值,以便以簡單的方式返回我的Dictionary<string, ObservableCollection<string>>

在此先感謝您的幫助。

+0

任何你不使用數據表的原因? – Ramin

回答

1

您可以使用Dictionary<string, ObservableCollection<string>>並將該字符串綁定到列標題,並將ObservableCollection<string>>綁定到該列。

+0

對不起我已經使用此字典>但我的問題有一個壞的文本格式。 – Alphapage

+0

我這樣做的頭︰'foreach(string s in entries.Keys) dataGrid1.Columns.Add(new DataGridTextColumn {Header = s}); dataGrid1.ItemsSource = entries.Values;' – Alphapage

+0

列顯示正確,但我可以顯示我的列表 – Alphapage

相關問題