Reputation: 16149
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.
Upvotes: 0
Views: 2367
Reputation: 5199
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.
Upvotes: 0