DataGridTableStyle ts1 = new DataGridTableStyle();
ts1.MappingName = "default";
DataGridTextBoxColumn ID = new DataGridTextBoxColumn();
ID.MappingName = "Fid";
ID.HeaderText = "PR No";
ID .ReadOnly = true;
//ID.Width = 120;
ID .TextBox.AutoSize = true;
ts1.PreferredColumnWidth = ID .TextBox.Width;
ts1.GridColumnStyles.Add(ID);ts1.AllowSorting = false;//加个checkbox
DataGridBoolColumn Release = new DataGridBoolColumn();
Release.MappingName = "ARelease";
Release.HeaderText = "Release";
Release .AllowNull = true;
Release .ReadOnly = false;
Release .TrueValue = true;
Release .FalseValue = Convert.DBNull;
Release .NullValue = Convert.DBNull;
ts1.GridColumnStyles.Add(Release);// Add the DataGridTableStyle objects to the collection.
dataGrid1.TableStyles.Add(ts1);