Forum Xamarin.Forms

For Skier Sharp Finger Paint( Color change)

It is possible to draw, but if you change the color, the color will change even to the line you drew before changing the color.

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    Reset the StrokeColor of all the polylines stored before .

    Modification based on official sample .

    1. Override SelectedIndexChanged method of Picker in FingerPaintPage.

    2. Retrieve the polyline list and reset their color , and then call canvasView.InvalidateSurface(); .

     private void colorPicker_SelectedIndexChanged(object sender, EventArgs e)
            {
                foreach (FingerPaintPolyline polyline in completedPolylines)
                {
                    polyline.StrokeColor = (Color)typeof(Color).GetRuntimeField(colorPicker.Items[colorPicker.SelectedIndex]).GetValue(null);
                    canvasView.InvalidateSurface();
                }
            }
    

    Then all the polylines drew before will change the new color .


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Sign In or Register to comment.