Hello, Telerik Support Team!
I am quite new with Telerik WPF components, so do not throw bricks at me if I ask some obvious questions.
So I try to create an application with PDFViewer. I have some PDF documents with their addresses in different places in some PC. These addresses are bounded to some controls (f.e. buttons). So I would like to click on the button for document 1 - and document 1 appears on screen, then I click on button for document 2 - and document 2 appears on screen and so on.
So, I red the previous topic (https://www.telerik.com/forums/radpdfviewer-document-binding-in-mvvm) - so I tried to fill my DocumentSource property in ModelView constructor and it works normally and PDFViewer shows document.
However, when I tried to bind some relaycommand, which changed DocumentSource property, to some button - after I clicked on this button in some unexplainable (just for me) reason document didn“t changed (however relaycommand was executed) and first document remains in PDFViewer on the screen.
Here is my method (from ModelView), which changed DocumentSource property:
---------------------------------------------------------------------------------------------------
private void LoadAnotherPDFDocument()
{
MemoryStream stream1 = new MemoryStream();
using (Stream input1 = File.OpenRead(AnotherPdfFilePath))
{
input1.CopyTo(stream1);
}
FormatProviderSettings settings1 = new FormatProviderSettings(ReadingMode.AllAtOnce);
PDFDocument = new PdfDocumentSource(stream1);
}
---------------------------------------------------------------------------------------------------
And here is my DocumentSourceProperty:
---------------------------------------------------------------------------------------------------
PdfDocumentSource _PDFDocument;
public PdfDocumentSource PDFDocument
{
get { return _PDFDocument; }
set
{
if (_PDFDocument != value)
{
_PDFDocument = value;
OnPropertyChanged(nameof(PDFDocument));
OnPropertyChanged(nameof(MyProperty));
}
}
}
---------------------------------------------------------------------------------------------------
And DocumentSource from xaml is really bounded to DocumentSource property:
---------------------------------------------------------------------------------------------------
<telerik:RadPdfViewer x:Name="pdfViewer"
telerik:RadPdfViewerAttachedComponents.RegisterSignSignatureDialog="True"
telerik:RadPdfViewerAttachedComponents.RegisterFindDialog="True"
Grid.Row="2"
telerik:RadPdfViewerAttachedComponents.RegisterSignaturePropertiesDialog="True"
telerik:RadPdfViewerAttachedComponents.RegisterContextMenu="True"
DocumentSource="{Binding PDFDocument,Mode=TwoWay}"/>
---------------------------------------------------------------------------------------------------
So, can you help me? How can I open different documents without clicking on open button (I have only predifined documents in my app so I dont want to allow user to browse in hard disk).
Thank you in addition!
Best regards,
Alexander Panteleev