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.
Unfortunately, activation email could not send to your email. Please try again.

Highlight Selection change

Thread ID:

Created:

Updated:

Platform:

Replies:

126032 Sep 19,2016 02:45 PM Sep 21,2016 07:07 AM WPF 3
loading
Tags: GridControl
David
Asked On September 19, 2016 02:45 PM

Hi,

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));
grid.Model.CellSpanBackgrounds.Add(backgroundImage);

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 10:23 AM

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. 
 
 
Pannir 


David
Replied On September 20, 2016 10:44 AM

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. 

Thanks.

Attachment: Selection_example_5cf1078d.7z

Kanimozhi Bharathi [Syncfusion]
Replied On September 21, 2016 07:07 AM

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; 
 
Regards 
Kanimozhi B 


CONFIRMATION

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.

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.

;