wpf Snoop 看不到我的应用程序的子窗口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15137582/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 07:47:39  来源:igfitidea点击:

Snoop doesn't see my application's child windows

wpfwindowssnoop

提问by Tony Vitabile

When I run Snoop 2.8, it sees my program's main window and lists it in its ComboBox. However, my program creates a child window that is displayed by calling ChildWindow.Show(). No matter what I do, I can't snoop that child window. If I refresh the list of windows, it doesn't show up. If I drag the little cross hairs icon next to the binoculars over the child window, the main window comes up.

当我运行 Snoop 2.8 时,它会看到我程序的主窗口并在其ComboBox. 但是,我的程序创建了一个通过调用ChildWindow.Show(). 无论我做什么,我都无法窥探那个子窗口。如果我刷新窗口列表,它不会显示。如果我将双筒望远镜旁边的小十字准线图标拖到子窗口上,就会出现主窗口。

How do I Snoop my applicaton's child window?

如何窥探我的应用程序的子窗口?

回答by Dana Cartwright

When I use Snoop, I always first start snoop and then use the "shift+control" shortcut to focus on what I want. This seems to work even if I do it to a child window. So try this:

当我使用Snoop时,我总是先启动snoop,然后使用“shift+control”快捷键专注于我想要的。即使我对子窗口执行此操作,这似乎也有效。所以试试这个:

  1. Start application, open child window
  2. Run Snoop
  3. Snoop any window in the application
  4. Focus on your child window (click on the title bar of the window)
  5. Move the mouse over what you want to inspect, and hold down the Shift and Control keys simultaneously
  6. A red outline appears in your application, and you should see Snoop show/select the element in question in the tree. If you look up the visual tree on the left you will now see the child window is the parent of the tree.
  1. 启动应用程序,打开子窗口
  2. 运行窥探
  3. 窥探应用程序中的任何窗口
  4. 专注于您的子窗口(单击窗口的标题栏)
  5. 将鼠标移到要检查的内容上,同时按住 Shift 和 Control 键
  6. 您的应用程序中会出现一个红色轮廓,您应该会看到 Snoop 显示/选择树中的相关元素。如果您查看左侧的可视化树,您现在将看到子窗口是树的父窗口。

This solution was last tested in Snoop 2.8.

该解决方案最后在 Snoop 2.8 中进行了测试。

回答by mlemay

Have you ever look for WPF Inspector? I always use it instead of snoop and and never had any problem with child windows...

你有没有寻找过 WPF Inspector?我总是使用它而不是窥探,并且从来没有对子窗口有任何问题......

http://wpfinspector.codeplex.com/

http://wpfinspector.codeplex.com/