Using wpf tabcontrol and at run time adding a richtexttbox1 to tab control.
now need to save the contents of richtextbox.
with Winforms I used addhandler etc and worked vey well
can achieve ok if richtextbox is added at design time
Please point me in the right direction for C# and wpf
Thank you
Peter Howlett
Jithu ThomasPosted Jan 27, 2024, 6:31 PM
In WPF, you can dynamically add controls to a TabControl just like in WinForms. To achieve this, you can create a RichTextBox dynamically and add it to the TabItem of the TabControl. Follow the example to how you can achieve this in WPF:
Define your TabControl in XAML:
In your code-behind, add the logic to dynamically create RichTextBox and add it to a new TabItem
The example assumes that you have a TabControl named myTabControl in your XAML. It dynamically creates a new TabItem and adds a RichTextBox to it. The SaveRichTextBoxContent_Click method demonstrates how you can access the content of the RichTextBox and save it.