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

Highlight Selection change


I was wondering if there was anyway that the selection highlight style can be changed. I have been able to change the background color of the selection. I am doing it like this:

grid.Model.Options.DrawSelectionOptions = GridDrawSelectionOptions.ReplaceBackground;
grid.Model.Options.HighlightSelectionBackground = Brushes.DarkSlateGray;

I have a background that is spanning all of the cells. The original highlight is blue as well as semi transparent. This way it seems to override the whole background so you can't see the original background. Is there a way to change the color but also see the background image? Here is how I set the background image:

backgroundImage = new CellSpanBackgroundInfo(1, 1, numRows, numColumns);
backgroundImage.Background = new ImageBrush(CreateBitMapImage(imageSource));

I was also wondering how to change the border of the highlight selection. Basically what I want is to have the border of the selection become thicker so it looks like the selection is framed. Sort of like how it originally styles a single cell to have thicker borders. Here is what I tried and it didn't work:

grid.Model.Options.HighlightSelectionBorder = Brushes.DarkOrange;
grid.Model.Options.HighlightSelectionBorderWidth = 4.0;

Thanks for any help you can provide.

3 Replies

PS Pannir Selvam S Syncfusion Team September 20, 2016 02:23 PM UTC

Hi David, 
Thanks for contacting Syncfusion support. 
You can change the selection highlight color by setting the semi-transparent brush to HighlightSelectionAlphaBlend property of GridModelOptions like below. 
var brush = new SolidColorBrush(Colors.DarkSlateGray) {Opacity = 0.5}; 
grid.Model.Options.HighlightSelectionAlphaBlend = brush; 
You can change the selection frame and it thickness by setting the ExcelLikeSelectionFrame property as true like below. 
grid.Model.Options.ExcelLikeSelectionFrame = true; 
grid.Model.Options.HighlightSelectionBorder = Brushes.DarkOrange; 
grid.Model.Options.HighlightSelectionBorderWidth = 4.0; 
Please find the sample for above from the below location. 

DA David September 20, 2016 02:44 PM UTC

Amazing that is exactly what I am looking for. 

I do have an additional ask on top of what you supplied. Currently the way the selection is working is to not highlight the first cell that is selected. Is there a way to make it so the whole selection is in the background color. So basically the one cell that has a background of white I wish to have it be the grey color as well. I have included a picture of what I am. 


Attachment: Selection_example_5cf1078d.7z

KB Kanimozhi Bharathi Syncfusion Team September 21, 2016 11:07 AM UTC

Hi David, 
You can include the selection in the first cell by setting ShowCurrentCell property to false in the sample like below code example 
grid.Model.Options.ShowCurrentCell = false; 
Kanimozhi B 

Live Chat Icon For mobile
Up arrow icon