Hello,
Welcome to Microsoft Q&A!
Based on your code, your PrintService
class can't find _inkCanvas
object, _drawingCanvas
object, _printCanvas
object. The PrintService
Class can't directly get these XAML elements. You could pass these objects from UI when you create the PrintService
Class.
Like this.
private PointHelper _printHelper;
private InkCanvas _inkCanvas;
private Canvas _drawingCanvas, _printCanvas;
public PrintService(InkCanvas inkcanvas, Canvas drawingCanvas, Canvas printCanvas)
{
_inkCanvas = inkcanvas;
_drawingCanvas = drawingCanvas;
_printCanvas = printCanvas;
}
Then in the button click event, call it like this:
var service = new PrintService(yourinkcanvas,yourdrawcanvas,yourprintcanvas);
Thank you.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.