Datagridview moves upwards after a MessageBox is shown

0
0

Hi. I have a simple datagridview with a toolbar, both under a ribbonbar. I have it bound to a Collection and I’m performing simple CRUD operations through the grid. As long as those operations are reading, or writing it’s all good, but when I delete an entity the grid moves upwards and depending on the docking properties it might get underneath the component immediately over it, or push it and get both underneath the next component. I’ve had had this problem before, but I was able to fix it tinkering with the z-index of the components and the dock porperty, but not this time. Is there a fix or I have to just keep playing around with the different properties until the fix is gone?

 

P/S this doesn’t happen when filtering data, so it is not a problem with the grid changing its size, it seems to specifically happen when I delete a entity from the collection bound to the grid

Edit: the issue seems to be being triggered by the MessageBox object. I show a modal MessageBox and await for a dialogresult to proceed. By using breaks, I’ve noticed that It moves the moment the user clicks on a button, when the messagebox returns a dialogresult object

  • You must to post comments
0
0

The screenshots show the wrong docking. Just dock to top and dock to fill. There is nothing to fix. The order of the controls defines whether the fill uses the entirely available area or the area remaining after the other docked panels. Nothing gets resized by clicking unless  it’s done in your code. You may be seeing the browser scrolling an element into view, which is normal browser behavior.

  • Pablo Clavijo
    I think I fixed it. The problem seemed to be that I was inheriting from a base panel with the toolbar, but adding a new datagridview onto each subclass, leaving the toolbar uncoupled from said datagrid. Adding a datagrid to the parent component apparently fixed it. Thank you Luca
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.