Le problème c'est que si j'écris ça :
public IItemFilter<T> Filter
{
get
{
return _filter;
}
set
{
// Do not allow a null filter. Instead, use the "include all items" filter.
if (value == null) value = IncludeAllItemFilter<T>.Instance;
if (_filter != value)
{
_filter = value;
if (thrFilter != null)
thrFilter.Abort();
thrFilter = new Thread(() =>
{
FilterAndSort();
// The list has probably changed a lot, so get bound controls to reset.
});
thrFilter.Priority = ThreadPriority.Lowest;
thrFilter.Start();
OnListChanged(ListChangedType.Reset, -1);
}
}
}
OnListChanged() est appelée avant que le thread ne soit finit.
L'idéal serait de lever un évenement quand le thread thrFilter se termine ou est avorté et de déclancher OnListChanged() dans le thread principal quand cet évenement est levé. Mais je ne sais pas si cela est possible...
Mathmax
****************************************
