我有一个 .net winforms ListBox,我已经使用 .Add() 向其中添加了项目。我更改了列表中的一个对象,使其 ToString() 方法现在返回不同的值,但该项目的显示值不会更新。我需要调用什么来告诉 ListBox 重新读取 ToString 值?
如果您将相同的对象引用重新分配给相同的列表框项,列表框将刷新其显示值。例如:
Thingy thing = this.listBox1.Items[0];
thing.DoSomethingThatChangesToStringReturnValue();
this.listBox1.Items[0] = thing;
Run Code Online (Sandbox Code Playgroud)