ListView ItemChecked事件 [英] ListView ItemChecked event
问题描述
我有一个ListView,其中每个项目都有一个复选框.最初没有附加事件,我以编程方式设置了复选框的状态.之后,我将附加一个ItemCheckedEventHandler,并为附加该处理程序之前发生的每个事件触发事件处理程序.有没有办法可以在附加处理程序之前清除事件队列?
I have a ListView where each item has a checkbox. Initially there are no events attached and I set the state of the checkboxes programatically. After this I attach an ItemCheckedEventHandler and the event handler fires for each of the events that occurred before the handler was attached. Is there a way that I can clear the event queue before attaching the handler?
推荐答案
当事件以构造函数/InitializeComponent方法的形式添加时,我能够重新创建.
I was able to re-create when the event was added in the form constructor/InitializeComponent method.
我能够通过在表单的load事件中添加事件而不是构造函数/InitializeComponent方法来解决该问题.
And I was able to get around the problem by adding the event in the form's load event instead of the constructor/InitializeComponent method.
这篇关于ListView ItemChecked事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!