Error with XamlDataProvider

5 posts, 0 answers
  1. Nebojsa
    Nebojsa avatar
    18 posts
    Member since:
    Feb 2010

    Posted 22 Jan 2014 Link to this post

    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}"  />
    <dXAML:XamlDataProvider x:Name="XamlDataProvider1" RichTextBox="{Binding ElementName=richTextBox1}" Xaml="{Binding HeaderText, Mode=TwoWay}"  />

    i get, when app starts, error:


    Data at the root level is invalid. Line 1, position 1.
    in usercontrol header i have:

    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
  2. Yancho
    Yancho avatar
    72 posts

    Posted 27 Jan 2014 Link to this post

    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.

    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 >>
  3. Nebojsa
    Nebojsa avatar
    18 posts
    Member since:
    Feb 2010

    Posted 27 Jan 2014 in reply to Yancho Link to this post

    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.
  4. Pinho
    Pinho avatar
    42 posts
    Member since:
    Mar 2009

    Posted 21 Jul 2014 in reply to Nebojsa Link to this post

    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
  5. Petya
    Petya avatar
    990 posts

    Posted 24 Jul 2014 Link to this post

    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.

    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.
Back to Top