简体   繁体   English

C#Windows Phone 8应用程序段落

[英]C# windows phone 8 app paragraph

Hello I am new to Windows Phone app development. 您好,我是Windows Phone应用程序开发的新手。 I am right now developing an app that shows a paragraph of text. 我现在正在开发一个显示一段文字的应用程序。 I used a scroll viewer in order to show the text. 我使用了滚动查看器以显示文本。 I have put the entire paragraph in to a single text block. 我已将整个段落放在单个文本块中。 the problem is when I run the app the emulator displays only half of the text and the remaining half is not visible how to make all the text inside the paragraph visible??. 问题是当我运行应用程序时,模拟器仅显示一半的文本,而其余的一半不可见,如何使段落内的所有文本可见?? Thank you 谢谢

Try setting 尝试设定

TextWrapping="Wrap" on TextBlock

Also make sure scrollviewer size is not set to Auto as it will keep expanding to accommodate the text. 另外,还要确保scrollviewer的大小未设置为“自动”,因为它将不断扩展以容纳文本。 Try to give screen width size. 尝试提供屏幕宽度大小。

Use: 采用:

<ScrollViewer>
    <TextBlock Text="Your paragraph here" TextWrapping="Wrap" /> 
</ScrollViewer>

嗨,您可以像这样使用RichTextBox:

<RichTextBox FontSize="25" Background="Transparent"> <Paragraph> your text goes here. </Paragraph> </RichTextBox>

Just add below code. 只需添加以下代码。

XAML Code : XAML代码:

<ScrollViewer Grid.Row="1">
   <StackPanel>                
       <RichTextBox x:Name="richTxtBox" VerticalAlignment="Top"  Style="{StaticResource NormalRichTextBoxStyle}"/>
   </StackPanel>
</ScrollViewer>

Class Code :- 班级代码 :-

string str = "*****  Your String  *****";   
Paragraph p = new Paragraph();

Run myRun = new Run();
myRun.Text = str;
p.Inlines.Add(myRun); 

richTxtBox.Blocks.Add(p);

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

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