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 to hide the text for ColorEdit type?


When setting a CellType to GridCellTypeName.ColorEdit, our users can see the color name (ie. Silver) or the color number (ie. 72, 179, 187) on the field when they click on the cell and drag.
Is there a way to disallow selection on a column or setting the selection background and foreground color so the user cannot see those information?




Attachment: ColorEdit_e7951420.zip

3 Replies

SA Solai A L Syncfusion Team September 26, 2014 09:42 AM UTC

Hi Tuan,


Thank you for your interest in Syncfusion products.

 

To achieve your requirement use the event CurrentCellCloseDropDown and set the backcolor to forecolor. Please refer the below code snippet for further clarification and let us know if you have any concerns.

 

Code Snippet:

 

this.gridControl1.CurrentCellCloseDropDown += new PopupClosedEventHandler(gridControl1_CurrentCellCloseDropDown);

 

void gridControl1_CurrentCellCloseDropDown(object sender, PopupClosedEventArgs e)

        {

            GridDropDownColorUICellRenderer rend = this.gridControl1.CurrentCell.Renderer as GridDropDownColorUICellRenderer;

 

            if (rend != null && !string.IsNullOrEmpty(rend.ControlText))

            {

                this.gridControl1[rend.RowIndex, rend.ColIndex].TextColor = rend.StyleInfo.Interior.BackColor;

            }

        }


Thanks & Regards,

AL.Solai.



TL Tuan Lam September 26, 2014 05:34 PM UTC

I tried the code you gave but it doesn't work.  The CurrentCellCloseDropDown doesn't even trigger yet since user can highlight the text inside of the cell before the dropdown is closed.
Please check out the original post's attachment for detail.  This issue is related to changing the selected text color (foreground and background).


SA Solai A L Syncfusion Team September 30, 2014 05:21 AM UTC

Hi Tuan,

Thank you for your update.

Here with we have attached a sample implementing your requirement. Please refer this and still if you could not achieve your requirement then replicate your issue in this sample and send back to us. So, that it would be easy for us to provide a prompt solution.

Please let us know if you have any other concerns.

Thanks & Regards,

AL.Solai.


Attachment: WindowsFormsApplication5_e63b70c4.zip

Loader.
Live Chat Icon For mobile
Up arrow icon