Windows Phone 8 - RichTextBoxes

时间:2014-03-13 14:30:38

标签: c# xaml

文本格式在将文本插入RichTextBox时消失。有没有办法解决这个问题?

我在RichTextBox中有一些文本,我在创建RichTextBox时从XAML插入。然后我创建了一些按钮来格式化这些文本,但我仍然希望在格式化这些文本后插入更多文本,但问题是当我将更多文本插入RichTextBox时,我之前的格式从前一个文本中消失。抱歉拼错了那些单词。有没有办法解决这个问题。

<ScrollViewer x:Name="scrollViewer1" Grid.Row="1" VerticalScrollBarVisibility="Visible"
              Background="White" Cursor="Wait" Margin="14,10,12,0" Height="179"
              VerticalAlignment="Top">
    <RichTextBox:C1RichTextBox x:Name="writingArea" Phone:C1NagScreen.Nag="True"
                               IsReadOnly="True" Text="yes yes"/>
</ScrollViewer>
private void bButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
    FontWeight? fw = writingArea.Selection.FontWeight;
    writingArea.Selection.FontWeight = fw.HasValue && fw.Value == FontWeights.Bold
    ? FontWeights.Normal
    : FontWeights.Bold;  

    //writingArea.Rtf = @"{\rtf1\ansi This is in \b bold\b0.}";
}

private void aButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
    this.createArray('a');
}

private void cButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
    this.createArray('c');
}

0 个答案:

没有答案