简体   繁体   English

WPF / Windows Phone使用TextBlock.Inlines对齐文本

[英]Aligning text using TextBlock.Inlines for WPF/Windows Phone

I am using TextBlock.Inlines to programmatically set text properties in the "Behind Code" in my windows Phone app. 我正在使用TextBlock.Inlines在Windows Phone应用程序的“隐藏代码”中以编程方式设置文本属性。 Does anyone know how to programmatically align the text using inlines? 有谁知道如何以编程方式使用内联对齐文本? I've tried the applying the alignment property as depicted below without much luck. 我尝试了如下所示的应用alignment属性,但没有多大运气。

 MyLabel.Inlines.Add(new Run() { Text = "My Text  ", FontSize = 10, VerticalAlignment = new ( VerticalAlignment.Center) });

Thanks 谢谢

Are you really sure you want to use vertical alignment? 您确定要使用垂直对齐吗? You most probably want to use horizontal one instead. 您最可能想使用水平的。 Maybe this will fix your problem. 也许这可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM