Hey guys,
I have created a usercontrol (and by created I mean ripped off wholesale from a much better coder than me) that is basically a mini word processor. What I want to do is click on a richtextbox (hereinafter RTB) on my screen and then open the usercontrol and edit the text of that RTB. I already have the code to break down the first RTB and copy the content of all the blocks. I trigger an event to send the list of blocks over to the usercontrol where I form the flowdocument and set the usercontrol RTB.Document to the new flowdocument. Here is the trigger function:
Public Sub Import_Text_Event(B_Col As List(Of Block)) Handles frm.ExportText Dim flow As New FlowDocument For Each B As Block In B_Col flow.Blocks.Add(B) Next TextBox.Document = flow End Sub
Here 'TextBox' is the RTB that is set in the usercontrol. The problem is that it doesn't update on the usercontrol instance on my active form. I know that the flowdocument is being constructed properly. I've checked during debugging and confirmed that all the blocks copy and are sent over in B_Col (listed above) and the 'TextBox.Document = flow' works in other paces. I've used this format to tie two RTB's on the same page together so that the changes made in one are reflected in the other. Am I going about this the wrong way? I'm sending the flowdocument to the usercontrol class to make the update...is that not how this should work? Should I be making the change on the controlling form?
Anyway, I'm still new to WPF and even newer to Usercontrols so anything you can give me will be appreciated!