简体   繁体   English

从“MetroListView”中获取选定的项目文本

[英]Get selected Item Text from “MetroListView”

how can I get a selected Item vom "MetroListView?我怎样才能得到一个选定的项目vom“MetroListView?

Previously I had implemented this with a Listbox以前我用一个列表框实现了这个

StarcDevice = listBox2.GetItemText(listBox2.SelectedItem);

But with MetroListView I don't have such a Method但是对于 MetroListView 我没有这样的方法

I hope someone can help me.我希望有一个人可以帮助我。

You can get first element from selected items and get text with Text property.您可以从选定项目中获取第一个元素并使用Text属性获取文本。

StarcDevice = listBox2.SelectedItems[0]?.Text;

For fast search MetroListView members you can check here对于快速搜索 MetroListView 成员,您可以在此处查看

https://docs.microsoft.com/en-us/previous-versions/jj681324(v=msdn.10) https://docs.microsoft.com/en-us/previous-versions/jj681324(v=msdn.10)

For all people with the same problem.对于所有有同样问题的人。

Done it like the following像下面这样完成

StarcDevice = metroListViewSTARCDevice.SelectedItems[0].SubItems[0].Text;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM