简体   繁体   English

将隐藏属性设置为ListBox项-C#

[英]Set a hidden property to a ListBox Item - C#

hey, Does anybody knows a way to set a hidden value to a ListBox Item. 嘿,有人知道为ListBox Item设置隐藏值的方法吗? As an alternative i can use another listbox simultaneously. 作为替代,我可以同时使用另一个列表框。 Thanks. 谢谢。

You are probably looking for the Tag property. 您可能正在寻找Tag属性。 It holds an object type, which means you can save a reference to anything in there. 它包含一个对象类型,这意味着您可以在其中保存对任何内容的引用。

Although before setting on using the tag property, take a look at ItemsSource. 尽管在设置使用tag属性之前,请先查看ItemsSource。 Basically you can tie a collection of things to be the provider for your listbox, it's usually a superior alternative to dealing with Listbox items individually. 基本上,您可以将一组东西绑定为列表框的提供者,它通常是单独处理列表框项的一种更好的选择。

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

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