How do you debug a WPF user control in design mode?(如何在设计模式下调试 WPF 用户控件?)
问题描述
我创建了一个包含标签的 wpf 用户控件.标签的前台设置会根据检查多个条件的某些代码而更改.我的控件中的标签在设计时显示错误的颜色,但我无法弄清楚如何在设计时调试我的用户控件,以便我可以让它捕获断点(从而找出我的逻辑有缺陷的地方).控件上的颜色在运行时是正确的,只是在设计时显示不正确.
I have a wpf user control I created that contains a label. The label's foreground setting changes based on some code that checks a number of conditions. The label in my control is displaying the wrong color at design time but I cannot figure out how to debug my user control at design time so that I can have it catch breakpoints (and thus figure out where my logic is flawed). The color on the control is correct at run-time, it is only at design time that it is displayed incorrectly.
推荐答案
以下是在设计时调试控件的步骤:
Here are the steps to debug a control at design time:
- 启动第二个 Visual Studio 实例
- 从调试"菜单附加到第一个实例
- 在第二种情况下,打开控件的源代码
- 在适当的位置设置断点
- 在第一个 VS 实例中,重新加载设计器
请注意,此技术不限于控件;您还可以使用它来调试 VS 扩展,或在 Visual Studio 中执行的任何内容.
Note that this technique isn't limited to controls; you can also use it to debug VS extensions, or anything that executes within Visual Studio.
这篇关于如何在设计模式下调试 WPF 用户控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在设计模式下调试 WPF 用户控件?
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 输入按键事件处理程序 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01