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.
Syncfusion Feedback

Deriving GridComboBoxCellRenderer

Thread ID:

Created:

Updated:

Platform:

Replies:

49147 Sep 12,2006 11:29 AM UTC Sep 20,2006 11:19 AM UTC Windows Forms 8
loading
Tags: GridControl
Marek Solarski
Asked On September 12, 2006 11:29 AM UTC

Hello,

I derived my own cell renderer from GridComboBoxCellRenderer.

How can I prevent drop down container from closing down when it looses focus. I found
DropDownContainerCloseDropDown
but I didn''t find
"DropDownContainerClosingDropDown"

Maybe shouldn''t I derive from GridComboBoxCellRenderer?

Regards,
Marek Solarski


Administrator [Syncfusion]
Replied On September 12, 2006 11:46 AM UTC

Hi Marek,

You would have to derive the combobox cell renderer and override these methods.

protected override void OnCloseDropDown(Syncfusion.Windows.Forms.PopupCloseType reason)
{
if(reason != Syncfusion.Windows.Forms.PopupCloseType.Canceled)
base.OnCloseDropDown (reason);
}

protected override bool OnDeactivating()
{
if( !this.IsDroppedDown )
return base.OnDeactivating ();
else
return false;
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/ComboBox_ab5624a4.zip

Let me know if this helps.
Best Regards,
Haneef

Marek Solarski
Replied On September 13, 2006 09:36 AM UTC

Hi Haneef,

I helped and DropDownContainer does not close down when it looses focus, but only when the Grid gets that focus. If some other control gets focus, DropdownContainer unfortunatelly closes.

Is it possible the DropDownContainer to be shown in some kind of "ShowDialog" way?

More precisely I derived my own ComboBoxCellModel and put some controls on it. GridDataBoundGrid is one of such controls. I have to show confirm message box when user wants to delete a record from grid. DropDownContainer closes down when I click Yes on message box.

Thank you for your help.
Regards,
Marek

Administrator [Syncfusion]
Replied On September 13, 2006 09:59 AM UTC

Hi Mark,

>>>>Is it possible the DropDownContainer to be shown in some kind of "ShowDialog" way?

Yes. Please refer to the browser sample \In depth\DropDownFormAndUserControlSample shows how you can popup a Form from a grid cell.

The DropDownFormAndUserControlSample sample illustrates how to create a custom cell control that places a DropDown Form/UserControl in a cell. The sample actually does it in two ways. It shows you how to display a modal Form using the Form.ShowDialog on a button click within the cell by deriving the GridStaticCellModel / GridStaticCellRenderer. The second way is to derive from the GridDropDownCellModel/ GridDropDownCellRender to drop a UserControl in a manner that handles the focus issues that are involved with pop-ups.The CellControl in both cases displays a CheckedListBox in the dropdown. The CellValue lists the selected options as a comma delimited string. See the Derived Cell Control section in the Grid User’s Guide for more information on custom cell controls.

Here is a modified sample for implementing it.
http://www.syncfusion.com/Support/user/uploads/DropFormComboBox_f92588ef.zip

Let me know if you looking something different.
Thanks,
Haneef

Marek Solarski
Replied On September 13, 2006 12:15 PM UTC

Hi Haneef,

Thank you for providing sample.

Your sample is almost exactly what I need. If only I could type in the cell those comma separated values it would be great. I changed GridStaticCellModel to GridComboBoxCellModel and set DropDownStyle to GridDropDownStyle.Editable but it didn''t help.

What did I miss?

Regards,
Mark

Administrator [Syncfusion]
Replied On September 14, 2006 10:34 AM UTC

Hi Marek,

You can add the TexBox control to the grid in the DropDownFormCellRenderer''s constructor and set the location/size of the text in OnActivating/OnDeactivating override method. Please refer the attached sample for more details and let me know if you are looking something different.

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

Thanks,
Haneef

Marek Solarski
Replied On September 15, 2006 01:08 PM UTC

Hi Haneef,

Thank you for your example, it helped me a lot.

I wonder only if this is possible:

I''d like to have a cell model similar to comboBoxCellModel I mean showing text to the user, but saving Int64 to the dataSource.
I''m not sure which event should I ovveride to switch the displayed text dynamicly. I tried with

protected override void OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs e)

but setting value to e.Style.Text
(e.Style.Text = "My Text To Display")
makes Grid to save "My Text To Display" to datasource, which can''t be done (datasource holds Int64) - I''d like only the Grid to show this text in the cell.

OnPrepareViewStyleInfo doesn''t seem to be the best event to ovveride, it fires to often.

Can I make this whole working somehow?

Regards,
Marek

Administrator [Syncfusion]
Replied On September 18, 2006 09:00 AM UTC

Hi Marek,

You can handle the DrawCellDisplayText event of the grid and set the e.DisplayText to some new value to want to display. Use the e.Style.CellIdentity.RowIndex and e.Style.CellIdentity.ColIndex to get the row and column of the cell for which the displaytext has to be set. Below is some code snippet.

private void Grid_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
if(e.Style.CellIdentity.RowIndex > 0 && e.Style.CellIdentity.ColIndex == 3)
{
e.DisplayText = "Some Text";
}
}

Regards,
Rajagopal

Marek Solarski
Replied On September 20, 2006 11:19 AM UTC

Thank you for your help. It works!

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

;