public delegate void RefreshEventHandler();
public event RefreshEventHandler RefreshEvent;
...
private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
...
if (refresh)
{
View.Refresh();
RefreshEvent();
}
...
I then added an overload to the WPFCollection<T>.GetCollectionView() method that would handle setting up an event listener:
public ListCollectionView GetCollectionView(AutoRefreshCollectionViewSource arcvs, AutoRefreshCollectionViewSource.RefreshEventHandler handler)
{
arcvs.RefreshEvent += new AutoRefreshCollectionViewSource.RefreshEventHandler(handler);
return GetCollectionView(arcvs);
}
The handler simply calls the ListBox.ScrollIntoView on the currently SelectedItem. Seems to solve the problem.
No comments:
Post a Comment