WPF: Binding to commands in code behind

后端 未结 4 1165
梦如初夏
梦如初夏 2021-01-01 23:23

I have a WPF Microsoft Surface Application and I\'m using MVVM-Pattern.

I have some buttons that are created in code behind and I would like to bind commands to them

4条回答
  •  渐次进展
    2021-01-01 23:57

    This works

    Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl, AncestorLevel=1}, Path=SaveReservationCommand}"
    

提交回复
热议问题