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
130
Adding properties and methods to a cell derived from UltraGridCell?
posted

Guys, can this be done:

I have some special functionality needed behind cells in a particular col. I think I need to build a custom cell derived from UltrGridCell and assign that as the celltype on a given column. I don't want to go as far as building a whole new CellEditor, implementing interfaces and all. Just some extra functionality behind the loading of data and entering/clicking into the cell... I do realize this might not be a trivial pursuit.

As tha data is loaded (in this case manually and not bound), I'd like to set custom properties on a cell.

eg: ultraGrid1.Rows[3].Cells[3].SpecialProperty = "special value";

As the user double-clicks or presses return in a given cell, call some custom method.

eg: ultraGrid1.ActiveCell.SpecialMethod("input");

 Maybe doing things in the AfterCellActivate event or ClickCell, DoubleClickCell and KeyDown events...

 Any advice would be great.

 Thanks

 

 

Parents
  • 17259
    Offline posted

    I think replacing the cell could be very complicated if possible.

    You can achieve that in other ways.

    To store custom data for each cell you can use the cell.Tag property.

    To add functionallity you can use extension method like:

    public static class CellExtension

    {

        public static void SpecialMethod(this UltraGridCell cell, string input)

        {

            cell.Tag.....

        }

    }

Reply Children
No Data