【问题标题】:Select ListView Item by checking checkbox C#/WPF通过选中复选框 C#/WPF 选择 ListView 项
【发布时间】:2015-07-19 21:20:16
【问题描述】:

我有带有 ListView 的 UserControl,ListView 有 TileView 并且项目包含 Checkbox、Icon 和 label。

我找到了一种通过单击图标来选中复选框的方法,但我想通过选中复选框来选择项目。

【问题讨论】:

  • 我有 ListView (ListView1),每一行都有 Checkbox(checkB)、Icon(icon)、label(lblname)。我想通过单击复选框来选择行

标签: c# wpf listview checkbox listviewitem


【解决方案1】:

我不确定你的意思。 但是 ListView 有一个属性 ListItemIndex (或类似的东西)。

这是一个整数, -1 没有选择行 0 到 Count-1 从集合中选择行。

因此,您可以将此属性绑定到视图模型中的属性,以在每次编程时选择特定行。

【讨论】:

  • 我需要通过单击复选框来选择列表视图项
  • 是的,这就是我的意思。您要选择特定的 ListView 行。还是你的意思是别的?
  • 是的。通过单击复选框。
猜你喜欢
  • 2011-07-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多