@ -33,7 +33,7 @@ namespace Avalonia.Controls.Presenters
public static readonly StyledProperty < IBrush ? > CaretBrushProperty =
AvaloniaProperty . Register < TextPresenter , IBrush ? > ( nameof ( CaretBrush ) ) ;
public static readonly DirectProperty < TextPresenter , int > SelectionStartProperty =
TextBox . SelectionStartProperty . AddOwner < TextPresenter > (
o = > o . SelectionStart ,
@ -43,7 +43,7 @@ namespace Avalonia.Controls.Presenters
TextBox . SelectionEndProperty . AddOwner < TextPresenter > (
o = > o . SelectionEnd ,
( o , v ) = > o . SelectionEnd = v ) ;
/// <summary>
/// Defines the <see cref="Text"/> property.
/// </summary>
@ -65,6 +65,12 @@ namespace Avalonia.Controls.Presenters
public static readonly StyledProperty < TextWrapping > TextWrappingProperty =
TextBlock . TextWrappingProperty . AddOwner < TextPresenter > ( ) ;
/// <summary>
/// Defines the <see cref="LineHeight"/> property.
/// </summary>
public static readonly StyledProperty < double > LineHeightProperty =
AvaloniaProperty . Register < TextPresenter , double > ( nameof ( LineHeight ) , defaultValue : double . NaN ) ;
/// <summary>
/// Defines the <see cref="Background"/> property.
/// </summary>
@ -179,6 +185,15 @@ namespace Avalonia.Controls.Presenters
get = > GetValue ( TextWrappingProperty ) ;
set = > SetValue ( TextWrappingProperty , value ) ;
}
/// <summary>
/// Gets or sets the line height. By default, this is set to <see cref="double.NaN"/>, which determines the appropriate height automatically.
/// </summary>
public double LineHeight
{
get = > GetValue ( LineHeightProperty ) ;
set = > SetValue ( LineHeightProperty , value ) ;
}
/// <summary>
/// Gets or sets the text alignment.
@ -253,7 +268,7 @@ namespace Avalonia.Controls.Presenters
get = > GetValue ( CaretBrushProperty ) ;
set = > SetValue ( CaretBrushProperty , value ) ;
}
public int SelectionStart
{
get
@ -281,7 +296,7 @@ namespace Avalonia.Controls.Presenters
SetAndRaise ( SelectionEndProperty , ref _ selectionEnd , value ) ;
}
}
protected override bool BypassFlowDirectionPolicies = > true ;
/// <summary>
@ -301,7 +316,7 @@ namespace Avalonia.Controls.Presenters
var textLayout = new TextLayout ( text , typeface , FontSize , foreground , TextAlignment ,
TextWrapping , maxWidth : maxWidth , maxHeight : maxHeight , textStyleOverrides : textStyleOverrides ,
flowDirection : FlowDirection ) ;
flowDirection : FlowDirection , lineHeight : LineHeight ) ;
return textLayout ;
}