You can display a
UIElement
, such as an Image or a Button, in a
RichTextBox
.
This enables rich text scenarios, such as displaying content from a chat client and showing emoticons.
UI elements are active when the
RichTextBox
is in read-only mode and inactive in edit mode. For example, they can respond to input and receive focus only when they are in read-only mode. Use the
InlineUIContainer
tag to add content that is derived from
UIElement
.
The following shows how to add an image to a
RichTextBox
.
Private
Sub ImageRTB()
myRun.Text = "Displaying text with inline image"Dim MyImage AsNew Image()
MyImage.Source = New BitmapImage(New Uri("flower.jpg", UriKind.RelativeOrAbsolute))
MyImage.Height = 50
MyImage.Width = 50
Dim MyUI AsNew InlineUIContainer()
MyUI.Child = MyImage
MyRTB.Blocks.Add(myParagraph)
myParagraph.Inlines.Add(myRun)
myParagraph.Inlines.Add(MyUI)
MySP.Children.Add(MyRTB)
EndSub
Extracted from:
http://msdn.microsoft.com/en-us/library/ee681613(v=vs.95).aspx[
^]
Hope this helps,
AlienHamster