diff --git a/samples/XamlTestApplicationPcl/Views/MainWindow.paml b/samples/XamlTestApplicationPcl/Views/MainWindow.paml index d51e61500b..c3e2b458ec 100644 --- a/samples/XamlTestApplicationPcl/Views/MainWindow.paml +++ b/samples/XamlTestApplicationPcl/Views/MainWindow.paml @@ -63,6 +63,9 @@ + + + diff --git a/src/Perspex.Controls/Presenters/TextPresenter.cs b/src/Perspex.Controls/Presenters/TextPresenter.cs index 2948cd541a..4b68d160e5 100644 --- a/src/Perspex.Controls/Presenters/TextPresenter.cs +++ b/src/Perspex.Controls/Presenters/TextPresenter.cs @@ -180,7 +180,7 @@ namespace Perspex.Controls.Presenters FontFamily, FontSize, FontStyle, - TextAlignment.Left, + TextAlignment, FontWeight)) { return formattedText.Measure(); diff --git a/src/Perspex.Controls/TextBox.cs b/src/Perspex.Controls/TextBox.cs index b7da6d16c3..affa38c023 100644 --- a/src/Perspex.Controls/TextBox.cs +++ b/src/Perspex.Controls/TextBox.cs @@ -37,6 +37,9 @@ namespace Perspex.Controls public static readonly PerspexProperty TextProperty = TextBlock.TextProperty.AddOwner(); + public static readonly PerspexProperty TextAlignmentProperty = + TextBlock.TextAlignmentProperty.AddOwner(); + public static readonly PerspexProperty TextWrappingProperty = TextBlock.TextWrappingProperty.AddOwner(); @@ -109,6 +112,12 @@ namespace Perspex.Controls set { SetValue(TextProperty, value); } } + public TextAlignment TextAlignment + { + get { return GetValue(TextAlignmentProperty); } + set { SetValue(TextAlignmentProperty, value); } + } + public string Watermark { get { return GetValue(WatermarkProperty); } diff --git a/src/Perspex.Themes.Default/TextBox.paml b/src/Perspex.Themes.Default/TextBox.paml index 43cbe76071..8ed353c1e5 100644 --- a/src/Perspex.Themes.Default/TextBox.paml +++ b/src/Perspex.Themes.Default/TextBox.paml @@ -39,6 +39,7 @@ SelectionStart="{TemplateBinding SelectionStart}" SelectionEnd="{TemplateBinding SelectionEnd}" Text="{TemplateBinding Text}" + TextAlignment="{TemplateBinding TextAlignment}" TextWrapping="{TemplateBinding TextWrapping}"/>