app.xaml 中的网格样式使内容不可见 [英] Grid style in app.xaml makes content invisible

查看:35
本文介绍了app.xaml 中的网格样式使内容不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 app.xaml 中定义一个网格样式,包括背景颜色.但是,在那里设置颜色,会使整个内容立即不可见.

I want to define a grid style in the app.xaml, including the background color. However, setting the color there, makes the whole content instantly invisible.

执行应用程序时,出现以下内容:

When application is executed, the following appears:

在短时间内,该按钮可见.我如何防止这种情况发生,请记住,我希望网格具有全局背景颜色.

For a short moment, the button is visible. How do I prevent this from happening, keeping in mind, that I wish a global background color for grids.

推荐答案

您可以像以前那样为 Grid 使用全局样式.

You can use a global style for the Grid as you have done it.

您遇到的问题来自 Visual Studio.所以这个问题只存在,如果你通过 Visual Studio 启动应用程序.

The issue you have faced comes from Visual Studio. So the issue is only present, if you start the application via Visual Studio.

为了提供实时跟踪 UI 元素的可能性,VS 似乎添加了一个 AdornerLayerWindow,我想它也使用了一个 Grid,您会看到它.您可以在 Application.Current.Windows 中找到此窗口.

To give the possibility for live tracking of UI-Elements the VS seems to add an AdornerLayerWindow, which, I suppose, also uses a Grid, which you see. You can find this window in Application.Current.Windows.

要摆脱这种行为,您必须停用选项Options->Debugging->UI-Tools for XAML activate

To get rid of this behaviour you have to deactivate option Options->Debugging->UI-Tools for XAML activate

这篇关于app.xaml 中的网格样式使内容不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆