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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

One of the Combo box items should show in blue color.

Thread ID:

Created:

Updated:

Platform:

Replies:

75906 Aug 14,2008 11:17 AM UTC Sep 26,2008 04:21 AM UTC WinForms 10
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 14, 2008 11:17 AM UTC

Hi,

I have one grid and in that grid one of the columns is combo box. For example, Combo box items are 'aa', 'bb', 'cc', 'dd' in these items 'cc' is default item. So default item should be show in blue color.

There is another possibility, user can select default item , then in that case also default value should show in blue color.

I am using Syncfusion 5.1.1.47
Please give one sample.

Thanks
-Kishan


Administrator [Syncfusion]
Replied On August 14, 2008 11:39 AM UTC

Hi,

Pease find the attachment, contains .cs file and screen shot.

In that screen shot 'cc' should show in blue color.

Thanks
-Kishan



GridComboBoxCell_a7ce870.zip

SubhaSheela R [Syncfusion]
Replied On August 19, 2008 12:23 PM UTC


Hi Kishan,

Thanks for your interest in Syncfusion products.

You can handle the PrepareViewStyleInfo event to achieve the desired behavior.

Here is the code:


this.gridControl1.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(gridControl1_PrepareViewStyleInfo);
void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.Style.CellType == "ComboBox" && e.Style.Text == "cc")
e.Style.BackColor = Color.Blue;
}


Please let me know if it helps.

Regards,
Subhasheela R




Administrator [Syncfusion]
Replied On August 20, 2008 03:59 AM UTC

Hello Subhasheela,

I added the code which you have sent, but it is not working.
Will you please sent me a sample.

Thanks
-Kishan


Administrator [Syncfusion]
Replied On August 20, 2008 05:52 AM UTC

Hello Subhasheela,

Please ignore above reply.
I got your point, it is working fine for back color.
By using above code, if I select default item choice i.e. 'cc' then it is displaying in blue color, if I click again combobox it is showing all items in blue color.

But my requirement is, the item 'cc' should be show in blue color in the combox itself not after selecting it in the grid.
other items colors should not be show in blue color.

Thanks
-Kishan



GridComboBoxCell_8d89ca7e.zip

Administrator [Syncfusion]
Replied On August 25, 2008 06:20 AM UTC

Hello Subhasheela,

Please send me reply, it is urgent.
Let me know whether you understand or not?

Thanks
-Kishan


SubhaSheela R [Syncfusion]
Replied On August 25, 2008 12:31 PM UTC

Hi Kishan,

We regret for the delay caused.

Please try setting the below code snippet:


private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.Style.CellType == "ComboBox")
{
if (e.Style.Text == "cc")
{
e.Style.BackColor = Color.Blue;
e.Style.TextColor = Color.Red;
}
else
{
e.Style.BackColor = SystemColors.Window;
e.Style.TextColor = SystemColors.ControlText;
}
}
}


Let me know if it helps.

Regards,
Subhasheela R


Administrator [Syncfusion]
Replied On August 26, 2008 08:55 AM UTC

Hello Subhasheela,

It is not working.
Already you have sent this code snippet before it.
My requirement is combobox itself shoud show default item choice i.e. 'cc' in blue color not after selecting it and not all items show blue color.
I am using ComboBoxBase class and version 5.1.1.47

Let me know whether you understand or not?

Thanks
-Kishan


SubhaSheela R [Syncfusion]
Replied On September 2, 2008 06:36 AM UTC

Hi Kishan,

We regret for the long delay caused.

You need to check the CurrentCell.RowIndex and ColIndex in the CurrentCellShowingDropDown event and set ListBoxPart.DrawMode property to DrawMode.Normal. Please try the below code snippet and Let me know if this helps.

Here is the minimal sample that illustrates the same:

http://www.syncfusion.com/Support/user/uploads/DropDown_a2567a1c.zip

Please let me know if you have any queries.

Regards,
Subhasheela R


Administrator [Syncfusion]
Replied On September 26, 2008 03:00 AM UTC

Hello Subhasheela,

Sorry for delay reply.

With small modifications to above code it is working.


Thanks
-Kishan.


SubhaSheela R [Syncfusion]
Replied On September 26, 2008 04:21 AM UTC

Hi Kishan,

Thanks for your update.

Please feel free to open an new one if you have any queries.

Regards,
Subhasheela R


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.

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

;