1

私はMVVMを使用しており、次のコードが表示されています:

<Image Source="Content/img/heart_gray.png" Width="25" Height="25" Margin="0,0,5,0" HorizontalAlignment="Right" Visibility="{Binding LikeVisability}">
                                                <i:Interaction.Triggers>
                                                    <i:EventTrigger EventName="Tap">
                                                        <cmd:EventToCommand  Command="{Binding SetLikeCommand}" />
                                                    </i:EventTrigger>
                                                </i:Interaction.Triggers>
                                            </Image>

ビューモデル内:

プライベート RelayCommand setLike;

     public ICommand SetLikeCommand
    {
        get
        {
            return this.setLike ?? (this.setLike = new RelayCommand(this.SetLike));
        }
    }


    private void SetLike()
    {
        var t = "fsdf";
    }

メソッド SetLike() にブレークポイントを配置すると、画像をタップしてもプログラムが停止しません。たぶん、ビューで何か間違ったことをしているのですが、イベントをバインドする場所はどこですか? 助けてください!

4

1 に答える 1