Home Forums WinForms controls Xceed Grid for WinForms Extending rows in both master and detail grid to fit the space provided

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16737 |

    I have a master/detail gird and I need to make the rows extend out to the end of the space provided for the control.  I.E they don’t want any background showing to the right of the rows.  How do you suggest that I do this?  One idea I had was to add a dummy column and to dynamically change it’s width to occupy the remaining space.

    Imported from legacy forums. Posted by Bernard (had 3557 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve implemented this strategy.  I can get the main grid dummy column to extend to fill in the control width.  However, when I change the width of the detail column, the dummy columns width doesn’t change.

     I’m changing the detail grid width from it’s template.

    gridControl.DetailGridTemplates[0].Columns[“X”].Width = width;

    “X” is dummy column.

     

    Bernie

    Imported from legacy forums. Posted by Bernard (had 260 views)

    User (Old forums)
    Member
    Post count: 23064

    Since you do it on the template, and not on the actual instance, this is not taken into account if the grid is already drawn.  You must call UpdateDetailGrids() method on the GridControl for this to work.

    Imported from legacy forums. Posted by André (had 250 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m manually populating the detail grids.  When I call the UpdateDetailGrids() method I loose all my detail data, so that doesn’t work for me.  I tried to go back go through each main row and get its parent grid, and then change the column.width there, but that doesn’t work either.  Any ideas?

    Imported from legacy forums. Posted by Bernard (had 274 views)

    User (Old forums)
    Member
    Post count: 23064

    When you populate the detail grids, you have access to the actual instance of the grid, not the template.  You should be able to get the column and set its width.  Moreover, if your detail grids are synchronize (GridControl.SynchronizeDetailGrids = true), then you only need to do it once.

    e.g. :

    void gridControl1_InitializingDetailGrid( object sender, InitializingDetailGridEventArgs e )

    {

        e.Grid.AddingDataRow +=

    new AddingDataRowEventHandler( Grid_AddingDataRow );

        e.Grid.Columns[

    “DummyColumn” ].Width = width;

    }

     

    Imported from legacy forums. Posted by André (had 390 views)

    User (Old forums)
    Member
    Post count: 23064

    i’ve got a solution that works with constants but want to make it more fool proof.  I compare the widths to gridControl.Width and I have to adjust the mail headers by add 21 before comparing and deciding how much to extend the dummy colum.  I would like to not have to code 21 but calculate the value  from the control.

     Also, for the first detail grid I have to use an adjustment factor of 44.   The detail grid has a SideMargin.Width of 17 so I would think that 21 + 17 = 41 would be that value for that one but 44 is what works.

     How should I be calculating these?

     Thanks

    Imported from legacy forums. Posted by Bernard (had 231 views)

    User (Old forums)
    Member
    Post count: 23064

    Have you looked at the following post :

    http://xceed.com/CS/forums/thread/2642.aspx 

    You should be able to use the same logic and apply it to the detail gird.

     

    Imported from legacy forums. Posted by André (had 3860 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.