We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How do I prevent the current cell begin highlighted?

I have a very simple grid model where I want the cells to be non-editable and non-selectable -- I can't seem to achieve this. I've tried:

cell.IsEditable = false
cell.ReadOnly = true
cell.CellEditTemplate = null

But still, when I click a cell, it gets a black border and the contents of the cell are highlighted (causing the text to also wrap, making half the data scroll outside the visual area of the cell.

How do I prevent this?

1 Reply

KV Karthik Vishnu R Syncfusion Team April 14, 2010 05:52 PM UTC

Hi Wayne,

To disable seletion and also to make cell readonly please use the following code snippet:

this.grid.Model.TableStyle.CellType = "Static";
this.grid.Model.Options.ExcelLikeCurrentCell = false;
this.grid.Model.Options.AllowSelection = Syncfusion.Windows.Controls.Grid.GridSelectionFlags.None;

Also, to avoid text wrapping you can use the following code:

this.grid.Model.ResizeColumnsToFit(GridRangeInfo.Table(), GridResizeToFitOptions.None);

Above code sizes column based on cell content.

We have prepared a sample illustrating above features. You can download it from the following location:

http://www.syncfusion.com/uploads/redirect.aspx?file=WpfApplication7_ca414521.zip&team=development

Let us know if you need more details.

Regards,
Karthik

Loader.
Live Chat Icon For mobile
Up arrow icon