WPF ListView with buttons on each line

后端 未结 3 2133
渐次进展
渐次进展 2020-12-04 22:40

I have a list of Games which just has an ID, a Date, and a Time. I am setting this list as the DataContext.<

3条回答
  •  孤城傲影
    2020-12-04 23:05

    Easily. Add a Button to your DataTemplate, give it a Command and then set the CommandParameter="{Binding}". The DataContext within a DataTemplate is the object.

    As requested, some links to using commands.

    • WPF Commands Part 1: Basics
    • WPF Commands Part 2: Command Bindings and Gestures
    • MSDN Understanding Routed Events and Commands In WPF (ADVANCED)

    HTH,

提交回复
热议问题