This is a migrated thread and some comments may be shown as answers.

Error with XamlDataProvider

4 Answers 225 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Nebojsa
Top achievements
Rank 1
Nebojsa asked on 22 Jan 2014, 10:04 PM
Hi,
I hope that You can help me with one really annoying error. If I replace:
<dHTML:HtmlDataProvider x:Name="HtmlDataProvider1"  RichTextBox="{Binding ElementName=richTextBox1}" Html="{Binding HeaderText, Mode=TwoWay}"  />
with:
<dXAML:XamlDataProvider x:Name="XamlDataProvider1" RichTextBox="{Binding ElementName=richTextBox1}" Xaml="{Binding HeaderText, Mode=TwoWay}"  />

i get, when app starts, error:

XamlParseErrorOccurred:

Data at the root level is invalid. Line 1, position 1.
in usercontrol header i have:
xmlns:dHTML="clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html"
xmlns:dXAML="clr-namespace:Telerik.Windows.Documents.FormatProviders.Xaml;assembly=Telerik.Windows.Documents.FormatProviders.Xaml"

This is happening every time I start app, but if I undo changes, everything is again OK. This was working without problems few days ago. But, on the other side, same syntax working in other usercontrol.
Can You help?
Best Regards
Nebojsa Danilovic

4 Answers, 1 is accepted

Sort by
0
Missing User
answered on 27 Jan 2014, 03:56 PM
Hi Nebojsa,

Thank you for your interest in RadRichTextBox.

RadRichTextBox not only gives you the ability to display rich text content, but also helps you to import/export the same from/to different file formats. This’s why Data providers were created. You can decide which rich text providers is the best to your binding data.

Unfortunately, I tried but I was unable to reproduce the issue which you are facing. A possible reason for such an error might be caused by using inappropriate data provider. If you are going to use XamlDataProvider when you want to bind HTML source to RadRichTextBox, you would receive XamlParseException. Please check whether your binding data is in the same format as the data provider which is in use.

In a nutshell, if you are going to add the XamlFormatProvider in XAML, please, take a look at this article and this SDK example for a reference.

Could you please confirm the version of the control which you are using? In case you are still experiencing problems please send me a sample working project. This will be the fastest way to investigate the problem and try to provide a solution.

I hope this helps! Let me know how it goes.

Regards,
Yancho
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Nebojsa
Top achievements
Rank 1
answered on 27 Jan 2014, 06:12 PM
Hi Yancho,
thanks for answer. OK, I manage to resolve my problem and find out what caused the error. I simply tried to fill text in richtextbox from code behind when window is opened (richtextbox1.headertext="[Enter text here]") and that is obviously wrong. Now I had to find other way to do that.
But, now I have other problem, and maybe You can help me about that:
I have a radbook which itemssource is connected to collection<TemplatePage> of pages ("Pages"-my object is TemplatePage). And I have property IsDirty (bool) which showing me if user changed something on page. On every page I have Header and Footer controls which are radrichtextboxes,: Of course, I am using INotifyPropertyChanged interface to track changes:
<dXAML:XamlDataProvider x:Name="XamlDataProvider1"  RichTextBox="{Binding ElementName=richTextBox1}" Xaml="{Binding HeaderText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  />

It is working, but somehow it sets IsDirty property on more than one pages to true, when I load saved book from disk. I also have a listbox with same itemssource, and if i click on item which is not dirty, suddenly some others items(pages) are showing that theirs IsDirty property is changed to true. If I replace UpdateSourceTrigger to "LostFocus", behavior in listboxes was gone, but binding is not working any more (I enter something in Header, change focus to another control but nothing is happening). So, my question is:"How can I track changes in richtextbox and update variable in my view model to something (IsDirty=true)." Can you post little example with solution.
Best regards
Nebojsa Danilovic
P.S. If I change virtualization property of book to false, everything is working ok with UpdateSourceTriger=PropertyChanged, but performance is very bad, so it is not option for me.
0
Pinho
Top achievements
Rank 1
answered on 21 Jul 2014, 03:04 PM
Hi Nebojsa,

 did you find a solution for this?

 I'm having the same problem, the view model is not being updated with my changes although the bind is well set (I'm using a converter to change from RadDocument to string and vice-versa).

Thanks for any information,

L. Pinho
0
Petya
Telerik team
answered on 24 Jul 2014, 08:15 AM
Hello L. Pinho,

Could you please let me know whether the suggestion I made in the other forum thread helped? The most probable cause for malfunction of RadRichTextBox's UI widgets, format providers and spellchecking functionality is an issue in the control's use of MEF. If this is not the case we'd appreciate if you can send us a simple sample project, where we can look into the issue.

Let me know how it goes.

Regards,
Petya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
RichTextBox
Asked by
Nebojsa
Top achievements
Rank 1
Answers by
Missing User
Nebojsa
Top achievements
Rank 1
Pinho
Top achievements
Rank 1
Petya
Telerik team
Share this question
or