I use the Master/Details view from the UWP Community Toolkit and I am wrapping it in my "custom master/details view". This custom view should be able to print the current Detail
, so the DetailsTemplate
property on MasterDetailsView
. The problem is that I cannot pass a DataTemplate
to the UWP Toolkit Print Helper like this:
printHelper.AddFrameworkElementToPrint(NameOfMasterDetailsView.DetailsTemplate);
I tried to make a generic Page which has 2 DependencyProperties: 1) A data model, 2) a DataTemplate. This way I wanted to reuse the DataTemplate I used for the DetailsTemplate. I just passed those to a ContentPresenter:
<ContentPresenter ContentTemplate="{Binding MyDataTemplateProp}" Content="{Binding MyModelProp}"
(I also tried to use DataContext instead of Content).
Results stay the same: A blank page gets printed.
How can one print a DataTemplate
, populated with a data model?
More specific: how to print a detail page with the UWP Community Toolkit?