Browse Source

Add to logical children before notifying presenter.

This makes sure that newly added control items have the correct logical parent.
pull/3177/head
Steven Kirk 7 years ago
parent
commit
68b655b517
  1. 3
      src/Avalonia.Controls/ItemsControl.cs

3
src/Avalonia.Controls/ItemsControl.cs

@ -377,7 +377,6 @@ namespace Avalonia.Controls
protected virtual void ItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
UpdateItemCount();
Presenter?.ItemsChanged(e);
switch (e.Action)
{
@ -390,6 +389,8 @@ namespace Avalonia.Controls
break;
}
Presenter?.ItemsChanged(e);
var collection = sender as ICollection;
PseudoClasses.Set(":empty", collection == null || collection.Count == 0);
PseudoClasses.Set(":singleitem", collection != null && collection.Count == 1);

Loading…
Cancel
Save