csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
using Avalonia.Media;
|
|
using Avalonia.Media.TextFormatting;
|
|
using Avalonia.Utilities;
|
|
|
|
namespace Avalonia.Controls.Documents
|
|
{
|
|
internal class EmbeddedControlRun : DrawableTextRun
|
|
{
|
|
public EmbeddedControlRun(Control control, TextRunProperties properties)
|
|
{
|
|
Control = control;
|
|
Properties = properties;
|
|
}
|
|
|
|
public Control Control { get; }
|
|
|
|
public override TextRunProperties? Properties { get; }
|
|
|
|
public override Size Size => Control.DesiredSize;
|
|
|
|
public override double Baseline
|
|
{
|
|
get
|
|
{
|
|
double baseline = Size.Height;
|
|
double baselineOffsetValue = Control.GetValue<double>(TextBlock.BaselineOffsetProperty);
|
|
|
|
if (!MathUtilities.IsZero(baselineOffsetValue))
|
|
{
|
|
baseline = baselineOffsetValue;
|
|
}
|
|
|
|
return -baseline;
|
|
}
|
|
}
|
|
|
|
public override void Draw(DrawingContext drawingContext, Point origin)
|
|
{
|
|
//noop
|
|
}
|
|
}
|
|
}
|
|
|