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:
The Buffer is defined as:
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.
Regards
Neils
This is how I set up the DocxDataProvider:
<
telerikDocx:DocxDataProvider
x:Name
=
"docxProvider"
Docx
=
"{Binding Buffer, Mode=TwoWay}"
RichTextBox
=
"{Binding ElementName=radRichTextBox}"
SetupDocument
=
"docxProvider_OnSetupDocument"
>
</
telerikDocx:DocxDataProvider
>
The Buffer is defined as:
private
byte
[] _buffer;
public
byte
[] Buffer
{
get
{
return
this
._buffer;
}
set
{
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.
Regards
Neils