Hello,
I would like to ask about context menu of PDF viewer.
So, I have PDF viewer (which is located in some UserControl), it works fine. In my app I allow to user creating of custom bookmarks - just some name and page number. One of the ways, how can user create own bookmark - right click and choose create bookmark in context menu. To create this I would like to use custom RelayCommand, which is in ViewModel of MainWindow and also uses some properties from ViewModel of MainWindow.
So, there is some problem. Since PdfViewer has it own DataContext (Command Descriptors), I can't use PlacementTarget to get some information from Window/UserControl DataContext (I tried relative source - it doesn't work). I found a solution - I created addition class with own RelayCommand, that works with STATIC variables (instance of PDF viewer to get current page) and methods (to create bookmark) from ViewModel. But I really dont like it really this solution.
So, I would like to ask you, how can I use my custom
command from ViewModel in context menu of Pdf viewer? Or at least how can I
pass CurrentPageNumer as argument, when I click on my custom menu item (command
from custom class, which is initialized as static resource) in contextmenu of
PDFviewer?
Now it looks like that:
<telerik:RadMenuItem Header="Create Custom Bookmark"
Command="{Binding SomeCommand, Source={StaticResource
customClass}}"
Visibility="Visible" >
Thank you in advance!
Best regards,
Alexander