Fixed bug in collection where parent wasn't set

pull/119/head
dahall 2020-04-02 20:10:20 -06:00
parent e2ff8ebbd7
commit 54994c84bf
2 changed files with 4 additions and 2 deletions

View File

@ -13,7 +13,7 @@ namespace Vanara.Windows.Shell
/// <summary>Initializes a new instance of the <see cref="ThumbnailToolbar"/> class.</summary>
public ThumbnailToolbar()
{
Buttons = new ThumbnailToolbarButtonCollection();
Buttons = new ThumbnailToolbarButtonCollection(this);
Buttons.CollectionChanged += (s, e) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Buttons)));
}

View File

@ -11,9 +11,11 @@ namespace Vanara.Windows.Shell
public class ThumbnailToolbarButtonCollection : ObservableCollection<ThumbnailToolbarButton>
{
private const int maxBtns = 7;
private readonly ThumbnailToolbar Parent;
internal ThumbnailToolbarButtonCollection()
internal ThumbnailToolbarButtonCollection(ThumbnailToolbar parent)
{
Parent = parent;
CollectionChanged += OnCollectionChanged;
}