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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Highlight Selection change

Thread ID:





126032 Sep 19,2016 06:45 PM UTC Sep 21,2016 11:07 AM UTC WPF 3
Tags: GridControl
Asked On September 19, 2016 06:45 PM UTC


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.

Pannir Selvam S [Syncfusion]
Replied On 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. 

Replied On 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

Kanimozhi Bharathi [Syncfusion]
Replied On 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 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon