回复 3楼ljf31的帖子
恩,可以通过以下代码实现:
- public MainPage()
- {
- InitializeComponent();
- List<Student> sl = new List<Student>();
- sl.Add(new Student { Name = "fdsf\ndsfds" });
- sl.Add(new Student { Name = "fdsf\ndsfds" });
- sl.Add(new Student { Name = "fdsf\ndsfds" });
- this.c1datagrid1.ItemsSource = sl;
- this.c1datagrid1.LoadedColumnHeaderPresenter += c1datagrid1_LoadedColumnHeaderPresenter;
- this.c1datagrid1.ColumnHeaderHeight = 100;
- }
- void c1datagrid1_LoadedColumnHeaderPresenter(object sender, C1.Silverlight.DataGrid.DataGridColumnEventArgs e)
- {
- C1.Silverlight.DataGrid.C1DataGrid datagrid = sender as C1.Silverlight.DataGrid.C1DataGrid;
- if (e.Column.Index==0)
- {
- datagrid.Columns[0].Header = "na\nme";
- }
- }
- }
- public class Student
- {
- public string Name { get;set;}
- }
- }
- public class Student
- {
- public string Name { get;set;}
- }
复制代码 |