如何设置断点并使代码停止在 AttachedCommand 内的一行上?
在我的XAML中,我有这个命令(这是我从http://marlongrech.wordpress.com):
<TextBlock Text="Edit Test Customer">
<Commands:CommandBehaviorCollection.Behaviors>
<Commands:BehaviorBinding Event="MouseLeftButtonDown"
Command="{Binding ClickEditTestCustomer}"/>
</Commands:CommandBehaviorCollection.Behaviors>
</TextBlock>
然后在命令中,如果我在里面设置一个断点 ExecuteDelegate 代码,例如在“layoutManger...”行上,即使执行了该代码,它也不会在断点处停止(我看到了我的视图):
ClickEditTestCustomer = new SimpleCommand
{
ExecuteDelegate = parameterValue =>
{
LayoutManager layoutManager = container.Resolve<LayoutManager>();
layoutManager.DisplayViewAsPane("EditCustomer", "Edit Customer", new EditCustomerView());
}
};
我该如何设置断点并使代码停止在 AttachedCommand 内的一行上?
In my XAML I have this command (which is an AttachedCommand which I got from http://marlongrech.wordpress.com):
<TextBlock Text="Edit Test Customer">
<Commands:CommandBehaviorCollection.Behaviors>
<Commands:BehaviorBinding Event="MouseLeftButtonDown"
Command="{Binding ClickEditTestCustomer}"/>
</Commands:CommandBehaviorCollection.Behaviors>
</TextBlock>
Then in the command, if I set a breakpoint inside the ExecuteDelegate code, e.g. on "the "layoutManger..." line, it doesn't stop on the breakpoint even though that code is executed (I see my view):
ClickEditTestCustomer = new SimpleCommand
{
ExecuteDelegate = parameterValue =>
{
LayoutManager layoutManager = container.Resolve<LayoutManager>();
layoutManager.DisplayViewAsPane("EditCustomer", "Edit Customer", new EditCustomerView());
}
};
How can I set a breakpoint and have the code stop on a line inside an AttachedCommand?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该没有任何问题。如果您 100% 确定 LayoutManager 行实际上正在运行,那么可能是我的代码 (JMC) 的调试功能有问题。尝试禁用 JMC 并再次运行场景
This should work without any problem. If you are 100% sure that the LayoutManager line is actually running then it may be a problem with the debugging feature just my code (JMC). Try disabling JMC and running the scenario again
答案是我在两次中无意中复制了事件处理程序ClickEditTestCustomer,令人惊讶的是,它没有产生错误,并且只安静地执行了第二个实例:
The answer was that I had inadvertently copied in the event handler ClickEditTestCustomer in twice, which surprisingly didn't produce an error and quietly executed only the second instance: