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
785
What event is fired once the grid is done rendering and has settled down?
posted

For the life of me I can not figure out what event is fired that says "I've bound myself to the data, I've sized my columns, I've displayed, and I'm ready for you to change me.  Hey, even my 'Resolved' properties have been resolved"?

What I'm really trying to do is have the grid render itself completely and then reset a few properties.  The properties are not yet ready to be reset during the form's Load event (even when calling the base.OnLoad).  

A snippet:

  • Tell grid to AutoFitStyle.ResizeAllColumns.
  • bind grid.
  • set fixed column sizes.

... Let Grid render and compute proper column sizes for non-fixed columns.

Receive special unknown event telling me all rendering is done
  • Grab the column.CellSizeResolved.Width of the non-fixed columns.
  • Tell grid to AutoFitStyle.None.
  • Reset the column.Width to the 'grabbed' resolved widths above.
This will make the grid size all non-fixed columns to their WeightX'ed sizes filling up all horizontal space available and then allow me to reset the grid to not allow auto adjusting of column sizes when the form is moved or the user resizes a non-fixed width column.
Parents
  • 469350
    Verified Answer
    Offline posted

    I'm not sure I understand exactly what the point of this is. If I understand correctly what you are trying to do here, then if the user increased the size of the form (and thus the size of the grid) wouldn't there be extra space in the grid? Or if they made the grid smaller, wouldn't columns get cut off? Why fix the column widths to an arbirary size based on the size of the form at load time?

    There is no event that fires when the grid is "done". You might be able to force the grid to update itself and calcaulate the sizes, though. Try calling grid.DisplayLayout.UIElement.VerifyChildElements(true). As long as all the other properties have been set before you do this and the grid is the correct size, this should force the grid to create the columns and size them, I think. 

Reply Children
No Data