RichTextBox.Xaml Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets or sets a XAML representation of the content in the RichTextBox.
Assembly: System.Windows (in System.Windows.dll)
Property Value
Type: System.StringA String object that is a XAML representation of the content in the RichTextBox.
The XAML string returned by the Xaml property will only include the following elements:
Note: |
|---|
Note that The XAML string returned by the Xaml property will not include any UIElement objects that are present in the content. The InlineUIContainer objects will be converted to empty Run objects. |
The following table lists various elements and the corresponding properties that are included in the string returned by the Xaml property.
Element | Properties |
|---|---|
Note:The Xaml property only supports attribute values that can be represented as a string. For example, to set the Foreground property, you can only use a SolidColorBrush and not a LinearGradientBrush. | |
The following code shows how the XAML is displayed by using the Xaml property.
'Set the xamlTb TextBox with the current XAML of the RichTextBox and make it visible. Any changes to the XAML made 'in xamlTb is also reflected back on the RichTextBox. Note that the Xaml string returned by RichTextBox.Xaml will 'not include any UIElement contained in the current RichTextBox. Hence the UIElements will be lost when you 'set the Xaml back again from the xamlTb to the RichTextBox. Public Sub btnMarkUp_Checked(ByVal sender As Object, ByVal e As RoutedEventArgs) If btnMarkUp.IsChecked.Value Then xamlTb.Visibility = System.Windows.Visibility.Visible xamlTb.IsTabStop = True xamlTb.Text = rtb.Xaml Else rtb.Xaml = xamlTb.Text xamlTb.Visibility = System.Windows.Visibility.Collapsed xamlTb.IsTabStop = False End If End Sub
Note: