Joe Buckle
Top achievements
Rank 1
Joe Buckle
asked on 18 Feb 2011, 12:24 PM
Good day!
I'm not completely sure how this feature of the RadRichTextBox work
- Support for embedding Silverlight UI elements
Would that allow me to design Word-like templates?
Thank you very much.
3 Answers, 1 is accepted
0
Hello Joe Buckle,
I have responded in your other forum thread, over here.
More information on the InlineUIContainer itself can be found in the help.
Best wishes,
Ivailo
the Telerik team
I have responded in your other forum thread, over here.
More information on the InlineUIContainer itself can be found in the help.
Best wishes,
Ivailo
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Joe Buckle
Top achievements
Rank 1
answered on 25 Feb 2011, 05:30 AM
Thank you for your response.
How can I update the height of the InlineUIContainer dynamically when a child control increases its height (so the height of the InlineUIContainer would be the same as the height of the stackpanel or the richtextbox)?
How can I update the height of the InlineUIContainer dynamically when a child control increases its height (so the height of the InlineUIContainer would be the same as the height of the stackpanel or the richtextbox)?
<
InlineUIContainer Width="400" Height="25">
<
StackPanel x:Name="stackPanel" Width="400" Height="25">
<ScrollViewer x:Name="scrollViewer" VerticalScrollBarVisibility="Auto" Padding="0">
<RichTextBox x:Name="richTextBox" AcceptsReturn="True" TextWrapping="Wrap" />
</ScrollViewer>
</StackPanel>
</InlineUIContainer>
Thanks.
0
Hi Joe Buckle,
You can handle the SizeChanged event of the ScrollViewer and update the height and width of the inline UI container like this:
Updating the layout, however, causes the editor to get the focus, which you can prevent like this:
If you have other questions, do not hesitate to contact us again. Greetings,
Iva
the Telerik team
If you have the following XAML:
<
telerik:RadRichTextBox
Name
=
"editor"
>
<
telerik:RadDocument
>
<
telerik:Section
>
<
telerik:Paragraph
>
<
telerik:InlineUIContainer
Width
=
"400"
Height
=
"25"
>
<
StackPanel
x:Name
=
"stackPanel"
Width
=
"400"
Height
=
"25"
>
<
ScrollViewer
x:Name
=
"scrollViewer"
VerticalScrollBarVisibility
=
"Auto"
Padding
=
"0"
SizeChanged
=
"scrollViewer_SizeChanged"
>
<
RichTextBox
x:Name
=
"richTextBox"
AcceptsReturn
=
"True"
TextWrapping
=
"Wrap"
/>
</
ScrollViewer
>
</
StackPanel
>
</
telerik:InlineUIContainer
>
</
telerik:Paragraph
>
</
telerik:Section
>
</
telerik:RadDocument
>
</
telerik:RadRichTextBox
>
You can handle the SizeChanged event of the ScrollViewer and update the height and width of the inline UI container like this:
private
void
scrollViewer_SizeChanged(
object
sender, SizeChangedEventArgs e)
{
foreach
(var container
in
this
.editor.Document.EnumerateChildrenOfType<InlineUIContainer>())
{
if
(container.UiElement.Equals((sender
as
ScrollViewer).Parent))
{
container.Height = e.NewSize.Height;
container.Width = e.NewSize.Width;
this
.editor.UpdateEditorLayout();
break
;
}
}
}
Updating the layout, however, causes the editor to get the focus, which you can prevent like this:
private
void
scrollViewer_SizeChanged(
object
sender, SizeChangedEventArgs e)
{
Dispatcher.BeginInvoke(() =>
{
this
.editor.IsFocusable =
false
;
foreach
(var container
in
this
.editor.Document.EnumerateChildrenOfType<InlineUIContainer>())
{
if
(container.UiElement.Equals((sender
as
ScrollViewer).Parent))
{
container.Height = e.NewSize.Height;
container.Width = e.NewSize.Width;
this
.editor.UpdateEditorLayout();
break
;
}
}
this
.editor.IsFocusable =
true
;
});
}
If you have other questions, do not hesitate to contact us again. Greetings,
Iva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!