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
45
Using custom controls into UltraGrid's cell
posted

Hi all,

My team and I have developed a custom control based on the UltraTextEditor component. This one is used in our application in order to format the display of numerical datas, and especially for showing empty text when the data value is equal to Long.minvalue.

This component is working fine using it on window Forms, but we have complications using it into an UltraGrid : at this time we are not able to control the text displayed into a Cell when this one is not in edit mode.
We can control the datas entered into a cell because we have associated the property EditorControl of that cell to an instance of our component. Our component gives an EmbeddableEditorBase version of it, and implements the IProvidesEmbeddableEditor interface, so when we set the property MyCell.EditorControl = OurCustomEditor, the property EditorResolved of the cell is automatically assigned to the OurCustomEmbeddableEditorBase component.
The text displayed into the cell is like we wanted it, BUT when we leave that cell, the text changes and seems to show the "ToString()" text of the value (here Long.ToString()).

My question is : with an UltraGrid, how can we specify that a cell should use the EditorControl text instead of the ToString() text of the contained value ?

Thanx

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    As you seem to be aware - the grid does not actually use the control you assign to the EditorControl property. All it does with this control is use it to get a copy of that controls editor. So any behavior that you want to affect in the grid would have to be handled on the editor. Nothing you override on the control will make much difference, unless it affects the editor's owner.

    The editor will get it's value from the owner. In the case of a grid cell, the owner is the grid, or more specifically the column in the grid.

    I'm not really sure what you are trying to do here since i have no idea how you are modifying the value of the control, but it seems like maybe you need to be using a DataFilter rather than (or maybe in addition to) implementing your own editor.

Children