|
|
|
@ -4,6 +4,7 @@ using Avalonia.Media; |
|
|
|
using Avalonia.Metadata; |
|
|
|
using Avalonia.Threading; |
|
|
|
using Avalonia.VisualTree; |
|
|
|
using Avalonia.Layout; |
|
|
|
|
|
|
|
namespace Avalonia.Controls.Presenters |
|
|
|
{ |
|
|
|
@ -312,7 +313,24 @@ namespace Avalonia.Controls.Presenters |
|
|
|
context.FillRectangle(background, new Rect(Bounds.Size)); |
|
|
|
} |
|
|
|
|
|
|
|
context.DrawText(Foreground, new Point(), FormattedText); |
|
|
|
double top = 0; |
|
|
|
var textSize = FormattedText.Bounds.Size; |
|
|
|
|
|
|
|
if (Bounds.Height < textSize.Height) |
|
|
|
{ |
|
|
|
switch (VerticalAlignment) |
|
|
|
{ |
|
|
|
case VerticalAlignment.Center: |
|
|
|
top += (Bounds.Height - textSize.Height) / 2; |
|
|
|
break; |
|
|
|
|
|
|
|
case VerticalAlignment.Bottom: |
|
|
|
top += (Bounds.Height - textSize.Height); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
context.DrawText(Foreground, new Point(0, top), FormattedText); |
|
|
|
} |
|
|
|
|
|
|
|
public override void Render(DrawingContext context) |
|
|
|
|