Browse Source
Merge branch 'master' into fix-vala-panel-global-menu
pull/12730/head
affederaffe
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
19 additions and
8 deletions
src/Avalonia.Controls/Documents/InlineUIContainer.cs
src/Avalonia.Controls/Primitives/ScrollBar.cs
src/Avalonia.Controls/TextBlock.cs
tests/Avalonia.Controls.UnitTests/TextBlockTests.cs
@ -58,6 +58,11 @@ namespace Avalonia.Controls.Documents
internal override void BuildTextRun ( IList < TextRun > textRuns )
{
if ( ! Child . IsMeasureValid )
{
Child . Measure ( Size . Infinity ) ;
}
textRuns . Add ( new EmbeddedControlRun ( Child , CreateTextRunProperties ( ) ) ) ;
}
@ -195,14 +195,15 @@ namespace Avalonia.Controls.Primitives
}
/// <summary>
/// Locates the first <see cref="ScrollViewer"/> ancestor and binds to its properties. Properties which have been set through other means are not bound.
/// Try to attach to TemplatedParent if it is a <see cref="ScrollViewer"/> and binds to its properties.
/// Properties which have been set through other means are not bound.
/// </summary>
/// <remarks>
/// This method is automatically called when the control is attached to a visual tree.
/// </remarks>
internal void AttachToScrollViewer ( )
{
var owner = this . FindAncestorOfType < ScrollViewer > ( ) ;
var owner = this . TemplatedParent as ScrollViewer ;
if ( owner = = null )
{
@ -679,14 +679,18 @@ namespace Avalonia.Controls
_ textRuns = textRuns ;
foreach ( var textRun in _ textRun s )
foreach ( var textLine in TextLayout . TextLine s )
{
if ( textRun is EmbeddedControlRun controlRun & &
controlRun . Control is Control control )
foreach ( var run in textLine . TextRuns )
{
VisualChildren . Add ( control ) ;
control . Measure ( Size . Infinity ) ;
if ( run is DrawableTextRun drawable )
{
if ( drawable is EmbeddedControlRun controlRun
& & controlRun . Control is Control control )
{
VisualChildren . Add ( control ) ;
}
}
}
}
}
@ -170,6 +170,7 @@ namespace Avalonia.Controls.UnitTests
target . Inlines . Add ( "123456" ) ;
target . Measure ( Size . Infinity ) ;
target . Arrange ( new Rect ( target . DesiredSize ) ) ;
Assert . True ( button . IsMeasureValid ) ;
Assert . Equal ( 8 0 , button . DesiredSize . Width ) ;