Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
XamRichTextEditor check Document for equality and empty
posted

Hi,

I am using the XamRichTextEditor in an XamGrid TemplateColumn and i have problems by comparing the richtextdocument. What i want to achieve is that if a user clicks in the cell and updates something in the XamRichTextEditor document i want to save the new version in the database. 

I have the following xaml column configuration:

                            HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >

   

       
           
                                                              ClipboardOperationExecuting="DescriptionEditor_OnClipboardOperationExecuting"
                                              GotFocus="DescriptionEditor_OnGotFocus"LostFocus="DescriptionEditor_OnLostFocus" Height="Auto"/>
                                                                 RefreshTrigger="Delayed" DelayAfterLastEdit="00:00:01.00" Visibility="Collapsed"
                                                 Value="{Binding Document}"/>
           
       
   

I have handled the following two events for this:

1) OnGotFocus -> Here i am saving the current RTF document to a stream by using the SaveToRtf method

2) OnLostFocus -> Her i am saving the new/updated RTF document to a stream by using the SaveToRtf method

The problem is now that if the user doesn't change anything i also get differences betweent the two streams. Why is that? Whats the Problem here?

How can i check if two rtf documents are equal? And how can i check if an document is empty?

Also if i "Export Content" from the Samples Browser i get different output and cannot compare two rtf documents.

Thanks in Advance!

Best Regards 

Rene