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

Background color for empty SfDataGrid

Hi

How to change BG Color for empty SfDataGrid from standard white to other one?

9 Replies

DY Deivaselvan Y Syncfusion Team November 22, 2018 10:48 AM UTC

Hi Adam,

Thank you for contacting Syncfusion support.

You can set the Background color of the DataGrid when its empty using the below code example.

 
this.sfDataGrid.TableControl.BackColor = Color.Red; 

Please let us know if you have any other questions.

Regards,
Deivaselvan 



AD Adam November 22, 2018 07:22 PM UTC

Hi
Thanks for the answer... now it´s working well I change the BG for example Red but I have still a "white hole" in my SfDataGrid (see Attach).
By which element I muss more change the BG Color?

regards
Adam


Attachment: 20181123_at_021437_b4565cf0.zip


DY Deivaselvan Y Syncfusion Team November 23, 2018 08:59 AM UTC

Hi Adam,

Thanks for the update.

On analyzing with the given image, we have found that the reported “white hole” denotes the indent cell of the group. Our proposed code will set Background color only to the DataGrid area and it should not apply to each type of cell. To meet your requirement, you should set same Background color to all the type of elements which is shown as white. Please refer the below code example which meet your requirement.

 
this.sfDataGrid.TableControl.BackColor = Color.Red; 
this.sfDataGrid.Style.GroupDropAreaStyle.BackColor = Color.Red; 
this.sfDataGrid.Style.IndentCellStyle.BackColor = Color.Red; 

Please let us know if you have any other questions.

Regards,
Deivaselvan 



AD Adam November 29, 2018 03:15 PM UTC

P-E-R-F-E-C-T

1000 Thanks :-)


DY Deivaselvan Y Syncfusion Team November 30, 2018 06:29 AM UTC

Hi Adam,

Thanks for your feedback. We are happy to assist you as always. Please let us know if you require any further assistance.

Regards,
Deivaselvan 



AD Adam November 30, 2018 07:45 PM UTC

Hi
I found one more "white hole" and hope will be the last :-D

Please with witch method cane I change the BackColor?

Thanks for Help

Attachment: LastWhiteHole_66f8c663.zip


DY Deivaselvan Y Syncfusion Team December 3, 2018 09:24 AM UTC

Hi Adam, 

Thanks for your update. 

Currently we don’t have direct support to change the back color of the size grip in the DataGrid. We don’t have any immediate plans to provide this support. At the planning stage for every release cycle, we review all open features.  We will let you know when this feature is implemented. 

However, we have a workaround to change the size grip color. Please refer the following code example and sample from the given location. 

Code Example :  

var sizeGrip = ReflectionHelper.GetProperty(this.sfDataGrid.TableControl.Style.GetType(), "SizeGrip").GetValue(this.sfDataGrid.TableControl.Style, null); 
ReflectionHelper.GetProperty(sizeGrip.GetType(), "BackColor").SetValue(sizeGrip, Color.Red, new object[] { }); 


Regards, 
Deivaselvan 



AD Adam December 4, 2018 08:13 AM UTC

SENSATIONAL !
You are my Hero. Thank you very much :-)

Adam


DY Deivaselvan Y Syncfusion Team December 4, 2018 10:05 AM UTC

Hi Adam,

Thanks for the appreciation.

Regards,
Deivaselvan 


Loader.
Up arrow icon