2 posts, 0 answers
  1. Heiko
    Heiko avatar
    153 posts
    Member since:
    Oct 2012

    Posted 05 Mar 2013 Link to this post

    I try to bind a RadRichTextBox via DocxDataProvider to a byte buffer in my ViewModel. However I run into a NullReferenceException. This happens during initialization (Docx property, BindingState: UpdatingSource) before any relevant part of my code is executed.

    This is how I set up the DocxDataProvider:

    <telerikDocx:DocxDataProvider x:Name="docxProvider"
                          Docx="{Binding Buffer, Mode=TwoWay}"
                          RichTextBox="{Binding ElementName=radRichTextBox}"

    The Buffer is defined as:

    private byte[] _buffer;
    public byte[] Buffer
            return this._buffer;
            this._buffer = value;
            this.RaisePropertyChanged(() => Buffer);

    I just load the view, set the DataContext to my ViewModel and that's all. When I set a breakpoint on the binding expression I can see that "Buffer" has the value of byte[0]. StackTrace says this happens at Telerik.Windows.Documents.FormatProviders.BinaryDataProviderBase.UpdateBytes()

    I am really stuck with this problem and don't know how to solve it.


  2. Petya
    Petya avatar
    990 posts

    Posted 08 Mar 2013 Link to this post

    Hello Neils,

    I am not sure what might be the problem. Please find attached a project demonstrating how binding can be implemented using DocxDataProvider.

    In case this does not help, please share some more details on your setup or even better, open a support ticket and send us a sample project we can use for troubleshooting.

    Let us know how it goes.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top