ブレークポイントを設定して、AttachedCommand内の行でコードを停止するにはどうすればよいですか?

StackOverflow https://stackoverflow.com/questions/1421664

質問

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 コード内にブレークポイントを設定した場合、たとえば&quot; the&quot; layoutManger ...&quot;行、そのコードが実行されてもブレークポイントで停止しません(私の意見が表示されます):

ClickEditTestCustomer = new SimpleCommand
{
    ExecuteDelegate = parameterValue =>
    {
        LayoutManager layoutManager = container.Resolve<LayoutManager>();
        layoutManager.DisplayViewAsPane("EditCustomer", "Edit Customer", new EditCustomerView());
    }
};

ブレークポイントを設定し、AttachedCommand内の行でコードを停止するにはどうすればよいですか

役に立ちましたか?

解決

これは問題なく動作するはずです。 LayoutManager行が実際に実行されていることを100%確信している場合、デバッグ機能(私のコード(JMC))に問題がある可能性があります。 JMCを無効にして、シナリオを再度実行してみてください

  • ツール-&gt;オプション-&gt;デバッグ-&gt;全般
  • [マイコードのみを有効にする]のチェックを外します

他のヒント

答えは、 2回のイベントハンドラー ClickEditTestCustomer を誤ってコピーしたことでした。驚くべきことに、エラーは発生せず、2番目のインスタンスのみを静かに実行しました:

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());
    }
};
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top