2012-11-23 89 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

相关问题