1
我必須忘記明顯的東西......我無法以編程方式綁定DataGridColumn。我有以下代碼:如何以編程方式綁定數據網格列?
var datagrid = new DataGrid();
datagrid.Columns.Add(new DataGridTextColumn()
{
Header = "Type,
Width = new DataGridLength(200),
FontSize = 12,
Binding = new Binding("Name") // this line fails to complile
});
我不斷收到以下編譯錯誤:
Error 3 The type or namespace name 'Binding' could not be found (are you missing a using directive or an assembly reference?)
我見過很多在線的例子,似乎在做同樣的事情...任何想法? 謝謝,
哇......它的確如此簡單....我只是不明白爲什麼第一個綁定沒有錯誤(只有在NEW之後的第二個綁定) - 但補充說明解決了問題當然 ... – JSchwartz 2013-04-25 12:14:55