Team,
Here is a simple code to implement "RichTextBox" in silverlight.
Call this function WriteTextintoRichTextBox() and send in the message to be shown in the textbox.
Happy coding.
Cheers
Anand
The XAML file content:
<Border Background="Red" Width="300" Height="300" VerticalAlignment="Bottom" HorizontalAlignment="Left" CornerRadius="10">
</Border>
The CS file content:
Paragraph rtbPara = new Paragraph();
Run rtbRun = new Run();
rtbRun.Text = toWriteInfo;
LineBreak rtbLineBreak = new LineBreak();
rtbPara.Inlines.Add(rtbRun);
this.richTextBox.Blocks.Add(rtbPara);
this.richTextBox.SelectAll();
}
Here is a simple code to implement "RichTextBox" in silverlight.
Call this function WriteTextintoRichTextBox() and send in the message to be shown in the textbox.
Happy coding.
Cheers
Anand
The XAML file content:
<Border Background="Red" Width="300" Height="300" VerticalAlignment="Bottom" HorizontalAlignment="Left" CornerRadius="10">
<RichTextBox x:Name="richTextBox" Margin="5,5,5,5"
IsReadOnly="True" >
</RichTextBox></Border>
The CS file content:
private void
WriteTextintoRichTextBox(string
toWriteInfo)
{Paragraph rtbPara = new Paragraph();
Run rtbRun = new Run();
rtbRun.Text = toWriteInfo;
LineBreak rtbLineBreak = new LineBreak();
rtbPara.Inlines.Add(rtbRun);
this.richTextBox.Blocks.Add(rtbPara);
this.richTextBox.SelectAll();
}
No comments:
Post a Comment