在我的 XAML 中,我有命令(这是我从http://marlongrech.wordpress.com获得的AttachedCommand):
<TextBlock Text="Edit Test Customer">
<Commands:CommandBehaviorCollection.Behaviors>
<Commands:BehaviorBinding Event="MouseLeftButtonDown"
Command="{Binding ClickEditTestCustomer}"/>
</Commands:CommandBehaviorCollection.Behaviors>
</TextBlock>
然后在命令中,如果我在 ExecuteDelegate 代码中设置断点,例如在“the”layoutManger ...“行中,即使执行该代码,它也不会在断点处停止(我看到我的观点):
ClickEditTestCustomer = new SimpleCommand
{
ExecuteDelegate = parameterValue =>
{
LayoutManager layoutManager = container.Resolve<LayoutManager>();
layoutManager.DisplayViewAsPane("EditCustomer", "Edit Customer", new EditCustomerView());
}
};
如何设置断点并让代码停在AttachedCommand内的一行?
答案 0 :(得分:1)
这应该没有任何问题。如果您100%确定LayoutManager行实际上正在运行,那么调试功能可能只是我的代码(JMC)的问题。尝试禁用JMC并再次运行方案
答案 1 :(得分:0)
答案是我无意中复制了两次中的事件处理程序 ClickEditTestCustomer ,这出人意料地没有产生错误并且只是静静地执行了第二个实例:< / p>
ClickEditTestCustomer = new SimpleCommand
{
ExecuteDelegate = parameterValue =>
{
LayoutManager layoutManager = container.Resolve<LayoutManager>();
layoutManager.DisplayViewAsPane("EditCustomer", "Edit Customer", new EditCustomerView());
}
};
ClickEditTestCustomer = new SimpleCommand
{
ExecuteDelegate = parameterValue =>
{
LayoutManager layoutManager = container.Resolve<LayoutManager>();
layoutManager.DisplayViewAsPane("EditCustomer", "Edit Customer", new EditCustomerView());
}
};