1

I want to do the Undo and Redo operations in the InkCanvas. How to do it?

how to get the strokes on the PointerReleasing. I have tried the code

path = new InkCanvas()
        {
            Height = mImageEditor.imageEditorPanel.ActualHeight,
            Width = mImageEditor.imageEditorPanel.ActualWidth
        };
        CoreInkIndependentInputSource core = CoreInkIndependentInputSource.Create(path.InkPresenter);
        core.PointerReleasing += Core_PointerReleasing;

        path.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse 
                                            | Windows.UI.Core.CoreInputDeviceTypes.Touch;
        InkDrawingAttributes inkDrawingAttributes = new InkDrawingAttributes();
        inkDrawingAttributes.Color = Windows.UI.Colors.Blue;
        inkDrawingAttributes.Size = new Size(8, 8);
        path.InkPresenter.UpdateDefaultDrawingAttributes(inkDrawingAttributes);
        var value = path.InkPresenter.StrokeContainer.GetStrokes();
        this.Children.Add(path);

I am getting this exception, so i can't able to get the strokes on pointer releasing event. enter image description here

How to do the Undo and Redo operations? Anyone please suggest me.

Santhiya
  • 191
  • 2
  • 14
  • You can find a sample [here](https://github.com/ashchuk/UWPImageEditor). It's Win2D sample, but I think it will be the same in your case too – ashchuk Sep 18 '17 at 14:32
  • Thanks for your sample. It is useful for me. But I am confusing why I am getting these exceptions. – Santhiya Sep 18 '17 at 17:31

0 Answers0