简体   繁体   English

WPF 中的空可视化树

[英]Empty visual tree in WPF

I just want to see visual elements of controls, and to do it I created a really basic window which contains two labels and button.我只想查看控件的视觉元素,为此我创建了一个非常基本的窗口,其中包含两个标签和按钮。 The problem is that I can't see any visual as I expected either in VisualTreeHelper or visual studio's tool named "WPF Tree Visualizer".问题是我在 VisualTreeHelper 或 Visual Studio 的名为“WPF Tree Visualizer”的工具中看不到任何视觉效果。

Current project当前的项目

The weird part is that it works in my another project.奇怪的是它适用于我的另一个项目。

Another project另一个项目

What may cause of this?这可能是什么原因? Why it doesn't work as in my other project?为什么它不像我的其他项目那样工作?

Looks like you are calling the code in the constructor.看起来您正在调用构造函数中的代码。 Try calling the same code in the window loaded event and you should see a difference.尝试在窗口加载事件中调用相同的代码,您应该会看到不同之处。

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

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