Today in the WPF design process, the use of the ListView, data binding in the template, which has a button click event, has not been executed, it is strange, find a long time to find a solution, or temporarily do not clear:
<listview x:name= "Lvwclass" itemssource= "{Binding classcollection}" grid.column= "1" >
<ListView.View>
<GridView>
<gridviewcolumn width= ">"
<GridViewColumn.Header>
<CheckBox>
<i:interaction. Triggers>
<i:eventtrigger eventname= "Checked" >
<command:eventtocommand command= "{Binding Classcheckchangedcommand}" commandparameter= "True" ></command: Eventtocommand>
</i:EventTrigger>
<i:eventtrigger eventname= "Unchecked" >
<command:eventtocommand command= "{Binding Classcheckchangedcommand}" commandparameter= "False" ></command: Eventtocommand>
</i:EventTrigger>
</i:interaction. Triggers>
</CheckBox>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<checkbox margin= "3,0,0,0" ischecked= "True" ></CheckBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<gridviewcolumn width= "" header= "serial number" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<textblock text= "{Binding converter={staticresource listviewindex},relativesource={relativesource AncestorType= {x:type ListViewItem}, Ancestorlevel=1}} "textwrapping=" Wrap "></TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<gridviewcolumn width= "Class" > "header="
<GridViewColumn.CellTemplate>
<DataTemplate>
<textblock text= "{Binding ClassName}" textwrapping= "Wrap" ></TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<gridviewcolumn width= header= "Operation" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<button content= "Clear" datacontext= "{Binding Id}" >
<i:interaction. Triggers>
<i:eventtrigger eventname= "click" >
<command:eventtocommand command= "{Binding Datacontext.classitemclearcommand,
Relativesource={relativesource Ancestortype=window,ancestorlevel=1}} "
commandparameter= "{Binding relativesource={relativesource ancestortype=listviewitem,ancestorlevel=1},path= DataContext} "
></command:EventToCommand>
</i:EventTrigger>
</i:interaction. Triggers>
</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
Solution not implemented for events in the MVVM template