Databinding the DataGrid column header in code
问题 How do I databind a WPF Toolkit DataGrid column header value in code (not XAML)? DataGridColumn fooColumn = new DataGridTextColumn { Header = "Foo", Binding = new Binding {Path = new PropertyPath("BindingPath"), Mode = BindingMode.OneWay} }; This databinds the content of the cells of the column. But how do I databind the header text ("Foo") itself (to, say, a string property on a viewmodel)? 回答1: DataGridColumn fooColumn = new DataGridTextColumn { Binding = new Binding {Path = new