0

In UWP I am using an InkCanvas to detect strokes. I would like to change the color of the current Stroke. I tried a couple of events but I'm only able to change the color of the Stroke after it has been collected through the following event:

InkCanvas.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected

private void InkPresenter_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args)
{
    foreach (InkStroke stroke in InkCanvas.InkPresenter.StrokeContainer.GetStrokes())
    {
        InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
        drawingAttributes.Color = Windows.UI.Colors.Blue;
        stroke.DrawingAttributes = drawingAttributes;
    }
}

I also tried the events on StrokeInput but I'm unable to find the current Stroke this way.

bkardol
  • 1,258
  • 1
  • 20
  • 32
  • Maybe I don't get what you want to do with the _current stroke_? Can't you change the `DefaultDrawingAttributes` _before_ the stroke is been drawn? – kennyzx Oct 05 '17 at 13:44
  • @kennyzx I would like to change the color of the stroke is drawn. For example: when the stroke is from left to right a blue color and from right to left an orange color. – bkardol Oct 06 '17 at 08:24
  • Please check [this](https://learn.microsoft.com/en-us/dotnet/framework/wpf/advanced/custom-rendering-ink#ImplementingCustomStrokes). Looks promising but I haven't tried this technique yet. – kennyzx Oct 06 '17 at 08:49
  • A heads up: Just found out it is WPF, not UWP. Might not be helpful. – kennyzx Oct 06 '17 at 08:56

0 Answers0