简体   繁体   English

即使设置了Visible = true,DevExpress XtraGrid也仍然不可见

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

I'm using DevExpress' tools on my current WinForms project. 我在当前的WinForms项目中使用的是DevExpress工具。 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 . 我正在处理的页面上有一个用于子代理商的网格,该网格是否可见,这取决于一个称为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 . 我什至尝试过继续并设置SubAgenciesGridControl.Visible = true No matter what I do it always has Visible set to false (even when debugging the line after SubAgenciesGridControl.Visible = true ). 无论我做什么,始终将Visible设置为false(即使在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): 这是我用来设置网格并切换其可见性的代码(我在WinForms上使用MVP模式):

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. 如果您使用的是LayoutControl尝试设置LayoutControlItemVisible属性。 The control's own visible property doesn't come into play if you're using a LayoutControl for layout rendering. 如果您使用LayoutControl进行布局渲染,则控件本身的visible属性将不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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