C# 如何在 XAML 中换行或换行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19386577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Line Break or new line in XAML
提问by Rizwan Qureshi
I am having hard time to match Special characters set in XAML. I only on the following:
我很难匹配 XAML 中设置的特殊字符。我只谈以下几点:
To represent a LineBreak in XAML hyperlink button:
要在 XAML 超链接按钮中表示 LineBreak:
use : > lineBreak <
使用:> lineBreak <
But What do I use to represent a New Line or LineBreak In XAML hyperlink button??
但是我用什么来表示 XAML 超链接按钮中的新行或换行符?
Example : I want this one line mag : This is line one. This is line two
示例:我想要这一行 mag:这是第一行。这是第二行
into this :
进入这个:
This is line one. This is line two.
这是第一行。这是第二行。
it seems this \r\n is not working. This is line one \r\n
看来这\r\n 不起作用。这是第一行\r\n
采纳答案by Chris W.
You've got options. For example;
你有选择。例如;
<HyperlinkButton Content="Line One Line Two"/>
or
或者
<HyperlinkButton>
<HyperlinkButton.Content>
<TextBlock>
<Run Text="Line 1"/><LineBreak/><Run Text="Line 2"/>
</TextBlock>
</HyperlinkButton.Content>
</HyperlinkButton>
Hope this helps.
希望这可以帮助。
Addendum: You can do this stuff in basically anything. WPF, Silverlight, UWP, whatever. It's not WP specific.
附录:你基本上可以在任何事情上做这些事情。WPF、Silverlight、UWP 等等。这不是特定于 WP 的。