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

Getting and setting cell boldness

Thread ID:





41417 Mar 1,2006 12:33 PM UTC Mar 7,2006 06:36 PM UTC WinForms 7
Tags: GridControl
Asked On March 1, 2006 12:33 PM UTC

Hi We are trying to store, and test, cell boldness in a virtual grid. We are setting event.Style.Font.Bold to true in our QueryCellFormattedText handler, and we have had some success with this approach, but we still have 2 problems: 1) We cannot retrieve the cell''s boldness from the grid -- grid[row, col].Font.Bold is still false, even though the cell shows up as bold; 2) We sometimes get exceptions reported by the grid when we try to set event.Style.Font.Bold: catched at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly) in:line 0 Do you have any advice for us?

stanleyj [Syncfusion]
Replied On March 2, 2006 09:36 AM UTC

Hi William, Retrieving of cell specific data will not be possible as the Virtual grid does not hold any data at all. All data are only available for a short period during drawing in the volatile data cache. This cache gets emptied once drawing is finished when Garbage collector collects memory. Let us know if you need further help. Regards, Stanley

Replied On March 2, 2006 10:58 AM UTC

Hi Stanley Thanks for the response; that explanation makes sense, although I''m a little surprised that requests like this aren''t delegated to our code -- would I perhaps be able to get this information if the back end were listening for some event that it currently isn''t?. For example, I can find the text in a cell with grid[row, col].FormattedText; this calls through to our QueryCellFormattedText handler. It seems that asking for grid[row, col].Font.Bold doesn''t fire any of QueryCellInfo, QueryCellModel, QueryCellText or QueryCellFormattedText; does it, in fact, definitely fire no events into which we can insert the requested information? Also: do you have any suggestions about the exceptions I mentioned in the first post? Thanks William

Replied On March 2, 2006 03:31 PM UTC

We have some more information about the exceptions we''ve been getting: Specified argument was out of the range of valid values. Parameter name: rowIndex Inner CLS stack trace: at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly) at Syncfusion.Windows.Forms.Grid.GridModel.ChangeCells(GridRangeInfo range, GridStyleInfo[] cellsInfo, StyleModifyType modifyType) at Syncfusion.Windows.Forms.Grid.GridModel.Syncfusion.Windows.Forms.Grid.IGridVolatileDataContainer.ChangeCell(Int32 rowIndex, Int32 colIndex, GridStyleInfo style) at Syncfusion.Windows.Forms.Grid.GridVolatileData.set_Item(Int32 rowIndex, Int32 colIndex, GridStyleInfo value) at Syncfusion.Windows.Forms.Grid.GridStyleInfoIdentity.OnStyleChanged(StyleInfoBase style, StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.OnSubObjectChanged(IStyleInfoSubObject subObject) at Syncfusion.Styles.StyleInfoSubObjectBase.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Windows.Forms.Grid.GridFontInfo.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.SetValue(StyleInfoProperty sip, Object value) at Syncfusion.Windows.Forms.Grid.GridFontInfo.set_Bold(Boolean value) We don''t see how rowIndex could be outside the allowed range; after all, the grid itself has asked us for the information about this cell, and we haven''t modified the CellIdentity property on the event. Thanks William

Administrator [Syncfusion]
Replied On March 2, 2006 04:24 PM UTC

hi William, a few days ago I had the same strange exception in my virtual grid. I couldn''t figure out why rowIndex should be out of range, but I found an workaround that was sufficient for my situation. Before calling gridControl.Refresh() somewhere in my implementation I explicitly setted gridControl.RowCount to my actual row count (e.g. gridControl.RowCount = yourDataArray.Count; gridControl.Refresh(); ) The problem vanished since then. Maybe it works for you too. Yours Christian!

Replied On March 2, 2006 07:03 PM UTC

Update: Thanks Christian -- as it happens, we''ve got this working, without exceptions, by setting Style and CellValue in our QueryCellInfo handler, and setting text (based on the previously-set CellValue) only in our QueryCellFormattedText handler. This allows us to get a cell''s boldness from the grid. However, we still have a related problem: When we start to edit a cell, and then cancel with the Esc key, the GridAwareTextBox we have connected to the grid stops showing the cell''s formatted value (as assigned to event.Text in our QueryCellFormattedText handler), and starts showing the result of CellValue.ToString(). At all other times, the GridAwareTextBox shows the expected formatted text. Can anyone offer any suggestions? Thanks again William

Replied On March 3, 2006 05:07 PM UTC

Hi William, may be you could register for the Grid.CurrentCellKeyDown event and check there if the user pressed the "Esc"-Key. If yes, explicitly set your desired formattedtext to the gridControl.CurrentCell.Renderer.ControlText or Grid.CurrentCell.Renderer.ControlValue. Or force the grid to fire the QueryCellFormatedText event again via gridControl.Refresh(). I''m not sure if one of these things works! Yours Christian!

Replied On March 7, 2006 06:36 PM UTC

Thanks Christian -- at present, we have a defect logged and will move on to it when it''s scheduled, so we can''t yet try out your approach. Thanks for your input, though (it all seems to make sense; we''ll probably start off with your suggestions when the time comes).


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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