简体   繁体   中英

DevExpress XtraGrid is not visible even after I set Visible = true

I'm using DevExpress' tools on my current WinForms project. The page that I'm working on has a grid for sub-agencies that is visible or not depending on a certain flag called IsParentAgency . If the agency is a parent agency, then the grid should be visible with all of the agency's sub-agencies. If not, then the grid should be invisible.

No matter what I do, though, I can't seem to get the grid to be visible. Even after I've given it a data source, forced it to initialize, and populated the columns. I've even tried going right ahead and setting SubAgenciesGridControl.Visible = true . No matter what I do it always has Visible set to false (even when debugging the line after SubAgenciesGridControl.Visible = true ).

Here's the code that I'm using to set up the grid and toggle its visibility (I'm using the MVP pattern on top of WinForms):

SubAgenciesGridControl.DataSource = Model.SubAgencies;
SubAgenciesGridControl.ForceInitialize();
SubAgenciesGridView.PopulateColumns();
SubAgenciesGridControl.Visible = Model.IsParentAgency;

How can I get the grid to be visible? It is adding it to the controls, as shown in the comments.

If you're using LayoutControl then try setting the LayoutControlItem 's Visible property. The control's own visible property doesn't come into play if you're using a LayoutControl for layout rendering.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM