Inserting-a-UI-Element in WPF RichTextBoxAdv (Classic)
4 May 20211 minute to read
In order to insert a UI element in the document, ParagraphAdv provides an inline called UIContainerAdv.
Properties
Property | Description | Type | Data Type |
---|---|---|---|
Height | Specifies the height of the image. | Dependency Property | Double |
Width | Specifies the width of the image. | Dependency Property | Double |
UIElement | Specifies the UI element to be added. | Dependency Property | UIElement |
FitToContent | Fits the UIElement based on the size of a page. | Dependency Property | Boolean |
Adding UIElement to an Application
UIContainerAdv can be used to add a UI element directly to an application by using the following code snippet:
<syncfusion:RichTextBoxAdv Height="300" Width="400" x:Name="richtext">
<syncfusion:DocumentAdv>
<syncfusion:SectionAdv>
<syncfusion:ParagraphAdv >
<syncfusion:UIContainerAdv >
<Button />
</syncfusion:UIContainerAdv>
</syncfusion:ParagraphAdv>
</syncfusion:SectionAdv>
</syncfusion:DocumentAdv>
</syncfusion:RichTextBoxAdv>
RichTextBoxAdv richtext = new RichTextBoxAdv();
DocumentAdv document = new DocumentAdv();
SectionAdv section = new SectionAdv();
ParagraphAdv paragraph = new ParagraphAdv();
UIContainerAdv uicontainer = new UIContainerAdv();
uicontainer.UIElement = new Button();
paragraph.Inlines.Add(uicontainer);
section.Blocks.Add(paragraph);
document.Sections.Add(section);
richtext.Document = document;
Limitations
Cut, copy, and paste operations are not permitted for the UIElement.