我无法在列表项中选择一行
这是我的代码
<Grid DockPanel.Dock="Left" MinWidth="250">
<ListView x:Name="ListVendors" ItemsSource="{Binding SourceCollection}">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style><Setter Property="FrameworkElement.Visibility" Value="Collapsed"/></Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Name}" FontSize="20"/>
<TextBlock Grid.Row="1" Text="{Binding Code}" Foreground="Gray" />
<TextBlock Grid.Row="2" Text="{Binding ContactNo}" Foreground="Gray" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Path=Address, Converter={StaticResource addNewLineConv}}" Grid.RowSpan="3" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="2" Text="{Binding Email}"/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Email}" Header="Email"/>
</GridView>
</ListView.View>
</ListView>
如何在 ListView 中选择一行?