Move event subscription to LoadComplete

Prevents attempting to read from the `colours` field before it is
actually injected.
This commit is contained in:
Bartłomiej Dach 2020-10-07 22:57:20 +02:00
parent 6627e7e459
commit b1029a124c
1 changed files with 6 additions and 1 deletions

View File

@ -113,7 +113,6 @@ public ControlGroupAttributes(ControlPointGroup group)
};
controlPoints = group.ControlPoints.GetBoundCopy();
controlPoints.CollectionChanged += (_, __) => createChildren();
}
[Resolved]
@ -125,6 +124,12 @@ private void load()
createChildren();
}
protected override void LoadComplete()
{
base.LoadComplete();
controlPoints.CollectionChanged += (_, __) => createChildren();
}
private void createChildren()
{
fill.ChildrenEnumerable = controlPoints.Select(createAttribute).Where(c => c != null);