Hi Telerik,
I am working with richtextbox. I am facing problem when I add text from code behind.
1. The richtextbox showing no text.
2. When I try to select text "Object reference not set" occur some time. Other time, after selecting the text become visible.
3. An additional enter is showing at the top of the richtextbox.
Regards
Animesh
I am working with richtextbox. I am facing problem when I add text from code behind.
1. The richtextbox showing no text.
2. When I try to select text "Object reference not set" occur some time. Other time, after selecting the text become visible.
3. An additional enter is showing at the top of the richtextbox.
<
Window
x:Class
=
"Imagine.TelerickTest.RichTextBox.WithoutMVVM"
xmlns:my
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Documents"
xmlns:radDoc
=
"clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents"
Title
=
"WithoutMVVM"
Height
=
"500"
Width
=
"500"
>
<
DockPanel
>
<
StackPanel
DockPanel.Dock
=
"Top"
>
<
TextBlock
Text
=
"Input"
></
TextBlock
>
<
TextBox
x:Name
=
"txtInput"
></
TextBox
>
</
StackPanel
>
<
Button
x:Name
=
"btnClick"
Content
=
"Click"
Click
=
"btnClick_Click"
DockPanel.Dock
=
"Top"
></
Button
>
<
my:RadRichTextBox
x:Name
=
"txtMessage"
LayoutMode
=
"Flow"
></
my:RadRichTextBox
>
</
DockPanel
>
</
Window
>
public WithoutMVVM()
{
InitializeComponent();
}
private void btnClick_Click(object sender, RoutedEventArgs e)
{
var span = new Telerik.Windows.Documents.Model.Span(txtInput.Text);
var p = new Telerik.Windows.Documents.Model.Paragraph();
p.Inlines.Add(span);
var section = new Telerik.Windows.Documents.Model.Section();
section.Blocks.Add(p);
txtMessage.Document.Sections.Add(section);
}
Regards
Animesh