Advertisement
smiche

Untitled

Feb 13th, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System
  2. Imports System.Windows
  3. Imports System.Windows.Controls
  4. Imports System.Windows.Media
  5. Imports System.Windows.Documents
  6. Namespace SDKSample
  7.     Partial Public Class BasicRichTextBoxWithContentExample
  8.         Inherits Page
  9.         Public Sub New()
  10.             Dim myStackPanel As New StackPanel()
  11.  
  12.             ' Create a FlowDocument to contain content for the RichTextBox.
  13.             Dim myFlowDoc As New FlowDocument()
  14.  
  15.             ' Create a Run of plain text and some bold text.
  16.             Dim myRun As New Run("This is flow content and you can ")
  17.             Dim myBold As New Bold(New Run("edit me!"))
  18.  
  19.             ' Create a paragraph and add the Run and Bold to it.
  20.             Dim myParagraph As New Paragraph()
  21.             myParagraph.Inlines.Add(myRun)
  22.             myParagraph.Inlines.Add(myBold)
  23.  
  24.             ' Add the paragraph to the FlowDocument.
  25.             myFlowDoc.Blocks.Add(myParagraph)
  26.  
  27.             Dim myRichTextBox As New RichTextBox()
  28.  
  29.             ' Add initial content to the RichTextBox.
  30.             myRichTextBox.Document = myFlowDoc
  31.  
  32.             myStackPanel.Children.Add(myRichTextBox)
  33.             Me.Content = myStackPanel
  34.  
  35.         End Sub
  36.     End Class
  37. End Namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement