Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
EditorComponent property is being cleared on column with custom GlyphInfoBase
posted

Hello,

I have a column bound to Boolean data, and instead of showing a checkbox control in each cell, I want to show an image for true and no image for false. I am doing this in the context of a re-usable component (I'll call it the "grid host") that can add columns to the grid at run-time.

I am attempting to achieve this by using an UltraCheckEditor and my own GlyphInfoBase class whenever the grid host adds a bound Boolean column to the grid. In the handler for the InitializeLayout event of the grid, I do the following for this special column.

  • Get a reference to the bound column in the grid.
  • Set the caption.
  • Create a new UltraCheckEditor.
    • Set its GlyphInfo property to a new instance of my custom GlyphInfoBase.
  • Set the column's EditorComponent property to the new UltraCheckEditor.
  • Set some other properties of the column.

The result is that I'm still getting checkboxes in this column instead of my image. Also, when I set a breakpoint in the Click event handler, I found that the EditorComponent property on the column is now null.

However, if I move the section of code that creates the UltraCheckEditor so that it executes in response to the InitializeRow event instead of InitializeLayout, my image shows up correctly. This doesn't seem like the correct solution though.

So, am I attaching to the wrong event for creating my UltraCheckEditors, or am I doing something else wrong?

I've left out a lot of details in an attempt to be brief. I can provide more detail if necessary.

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Andrew,

    I assume you are setting the EditorComponent property on the column and not the cell. Is that correct?

    When you click, are you also checking the EditorComponent on the column and not the cell?

    I don't see anything in your description here that could explain why the EditorComponent is being set to null. The grid certainly does not do this for any reason that would have anything to do with GlyphInfo. My guess is that something in your code is doing this inadvertently.

    The most obvious thing that springs to mind is that you are loading a Layout into the grid. Check your code for "DisplayLayout.Load" or similar code.

    Another possibility is that your InitializeLayout event is taking different paths. Maybe the part of the code that sets the EditorComponent is getting skipped sometimes and the InitializeLayout event is firing more than once? That should only happen if you are setting the DataSource/DataMember on the grid more than once, of course.

Children