WPF之DataGrid的LoadingRow事件

利用DataGrid的LoadingRow事件,可以进行设置DataGrid的DataGridRow的属性(例如样式:背景色、前景色;是否可修改数据)

实例代码如下:

  private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            Employee employee = e.Row.Item as Employee;
            //经理级别的数据行禁止修改
            e.Row.IsEnabled = !employee.Title.Contains("经理");
        }
原文地址:https://www.cnblogs.com/527289276qq/p/5332873.html