wpf如何在ItemTemplate绑定viewModel对象

                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Border BorderBrush="{StaticResource ListViewItem.GapLine.Background}">
                                <Grid>
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="MouseLeftButtonDown">
                                            <i:InvokeCommandAction Command="{Binding DataContext.ChangeSmallImageClickCommand, ElementName=Win}" CommandParameter="{Binding ElementName=lst, Path=SelectedItem}" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                    <Image
                                        Height="135"
                                        Source="{Binding PImage}"
                                        Stretch="Uniform" />
                                </Grid>
                            </Border>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
原文地址:https://www.cnblogs.com/zsx-blog/p/14452223.html