I am writing a custom panel and I would like to know how to tell my children that when they need to to remeasure their parent should also do the remeasuring.
As example one of the children changes its width and the parent should also remeasure again, leading his parent to also do the remeasuring and then the parent of his parent and the parent of his parent and so on.. Its like going up the VisualTree
. How do I do that?
Here is code of measure of panel.. but how to tell to parent to also remeasure
protected override Size MeasureOverride(Size availableSize)
{
double x;
double y;
var children = this.InternalChildren;
for (int i = 0; i < children.Count; i++)
{
UIElement child = children[i];
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity);
y += child.DesiredSize.Height;
x = Math.Max(x, child.DesiredSize.Width);
}
return new Size(x, y);
}