我有这个 xml 代码用于在 wpf 中显示列表视图项:
<ListView FlowDirection="RightToLeft" Name="ListViewPost" HorizontalAlignment="Left" Height="504" Margin="1060,172,0,0" VerticalAlignment="Top" Width="304" Background="White" BorderBrush="Black">
<ListView.View >
<GridView>
<GridViewColumn Width="300" Header="عنوان" DisplayMemberBinding="{Binding Title}"/>
</GridView>
</ListView.View>
</ListView>
并使用此代码在 messagebox 中显示 id:
private void listView1_MouseClick_1(object sender, RoutedEventArgs e)
{
int Id;
if (ListViewPost.SelectedIndex == -1) return;
Id = (int)ListViewPost.SelectedItems[0];
MessageBox.Show(Id.ToString());
}
现在我把断点放在这个函数中,但它没有进入这个。有什么问题 ?