FlexGrid: rows numeration and row detail grid fit

Posted by: a.sharov on 20 May 2022, 12:58 pm EST

    • Post Options:
    • Link

    Posted 20 May 2022, 12:58 pm EST - Updated 3 October 2022, 10:28 pm EST

    Hi.

    Few questions:

    1)Can I add some ephemeral column as a row counter,namely current row number like 1,2,3,4,5, ? I have bound data id, but it could be non-sequential or smth like 123,124,125 . I need plain sequential numbers starting from 1.

    1. Based on this sample (https://www.grapecity.com/blogs/getting-started-with-row-details-flexgrid-for-winforms) I’ve use flexgrid instead of flexchart, because I work with IEnumerables and not data sets. The thing is that everything is ok, but I have ugly free space which is not used by the detail control, so I want to fit detail control height (it’s container) to actual grid height (see image grey areas for more info). I want ot fit detail container control to actiual data (number of rows).

      This is my code for Update method:
    
       public void UpdateSize(C1FlexGrid parentGrid, int rowIndex, Size proposedSize)
              {
                  Width = parentGrid.Size.Width - 20;
                  //Height = c1FlexGrid1.DisplayRectangle.Height;
               
              }
    
    

    Width more or less ok, but height looks ugly --lots of wasted space.

    Thanks in advance.

  • Posted 23 May 2022, 7:20 am EST

    Hi,

    1. As per our understanding, you want to show row indices in a column in the C1FlexGrid. You can set the DrawMode property of the C1FlexGrid to OwnerDraw and handle its OwnerDrawCell event to show the row indices in the Row Headers. If you meant something else, please provide a screenshot showing the implementation you require so we can investigate further and assist you accordingly.

    2. To set the size of the User Control containing the child C1FlexGrid, you can manually calculate its size according to the Size of the C1FlexGrid and assign it to the Size property of the User Control.

    Kindly refer to the attached sample showing both of the above.

    RowDetailDemo_FG.zip

    Kind Regards,

    Kartik

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels