Browse Source

Adjust visual logical tree reset

pull/9147/head
Benedikt Stebner 4 years ago
parent
commit
cf16418d21
  1. 15
      src/Avalonia.Controls/RichTextBlock.cs

15
src/Avalonia.Controls/RichTextBlock.cs

@ -538,9 +538,14 @@ namespace Avalonia.Controls
protected override Size MeasureOverride(Size availableSize) protected override Size MeasureOverride(Size availableSize)
{ {
LogicalChildren.Clear(); if(_textRuns != null)
{
LogicalChildren.Clear();
VisualChildren.Clear();
VisualChildren.Clear(); _textRuns = null;
}
if (Inlines != null && Inlines.Count > 0) if (Inlines != null && Inlines.Count > 0)
{ {
@ -558,7 +563,7 @@ namespace Avalonia.Controls
if (textRun is EmbeddedControlRun controlRun && if (textRun is EmbeddedControlRun controlRun &&
controlRun.Control is Control control) controlRun.Control is Control control)
{ {
((ISetLogicalParent)control).SetParent(this); LogicalChildren.Add(control);
VisualChildren.Add(control); VisualChildren.Add(control);
@ -568,10 +573,6 @@ namespace Avalonia.Controls
_textRuns = textRuns; _textRuns = textRuns;
} }
else
{
_textRuns = null;
}
return base.MeasureOverride(availableSize); return base.MeasureOverride(availableSize);
} }

Loading…
Cancel
Save