Hi Feng,
Thanks for using Syncfusion products.
Regarding Non-Editable Cell:
In GridDataControl,
you can make particular column as non-editable by setting ReadOnly property as True in the respective VisibleColumn of the DataGrid like shown below:
Code Snippet[XAML]
- - -
- - -
- - -
- - -
In GridControl, you can make particular column or cell or row as non-editable by setting ReadOnly property as True in the QueryCellInfo event of the datagrid like shown below:
Code Snippet[C#]
this.grid.QueryCellInfo += new GridQueryCellInfoEventHandler(grid_QueryCellInfo);
void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.Cell.ColumnIndex > 3)
{
e.Style.ReadOnly = true;
}
e.Style.CellValue = string.Format("Row{0}/Col{1}",e.Style.RowIndex,e.Cell.ColumnIndex);
}
Regarding Background and Foreground Color for Selected Rows:
In GridDataControl, you can achieve your requirement like shown below:
Code Snippet[C#]
this.dataGrid.HighlightSelectionBackground = Brushes.Blue;
this.dataGrid.HighlightSelectionForeground = Brushes.White;
In GridControl, you can achieve your requirement like shown below:
Code Snippet[C#]
this.grid.Model.Options.DrawSelectionOptions = GridDrawSelectionOptions.ReplaceBackground | GridDrawSelectionOptions.ReplaceTextColor;
this.grid.Model.Options.HighlightSelectionBackground = Brushes.Blue;
this.grid.Model.Options.HighlightSelectionForeground = Brushes.White;
For your reference we have also attached the sample herewith.
GridDataControl:< http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDC1640753944.zip >
GridControl:< http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GC1485855858.zip >
Please let us know if you have any queries.
Thanks,
Rajasekar