我有一个 WPF 窗体,基本上看起来像这样:
<Window ...>
<Grid>
<DockPanel>
[content shown during normal operation]
</DockPanel>
<Grid Background="#CCCC" Visibility="Hidden">
[overlay grid which is only shown during special circumstances]
</Grid>
</Grid>
</Window>
这个覆盖网格会隐藏其他内容(即“普通内容”),只在特殊情况下显示出来(例如网络连接故障)。在运行程序时,这能够正常工作。
现在,在设计模式下,问题在于Visual Studio忽略了Visibility="Hidden"
。通常情况下,这是有道理的(毕竟我想要编辑隐藏的UI元素),但在我的情况下很烦人,因为它阻止我在设计器中编辑DockPanel中的内容。
所以,我想做的事情就像这样:
<Grid Background="#CCCC" Visibility="Hidden" VS.ShowInDesigner="False">
[overlay grid which is only shown during special circumstances]
</Grid>
但是,哀悼的是,并没有这样的属性,或者至少我不知道有。有什么想法吗?