2

I'm trying to retrieve the Points of a SignaturePad to redisplay the signature.

public static void GetPoints(string airid, SignaturePadView padView)
{
        List<Strokes> DBStrokes = SqLiteHelper.conn.Query<Strokes>("select * from Strokes where airid = ? order by PointSequence", airid);

        List<Point> points = new List<Point>();

        foreach (Strokes stroke in DBStrokes)
            points.Add(new Point { X = stroke.pointx, Y = stroke.pointy });

        padView.Points = points.AsEnumerable();
}

The array points is filled correctly, but the padView.Points shows as result {Xamarin.Forms.Point[0]}.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Klaus Grosche
  • 85
  • 1
  • 7

1 Answers1

0

I've found the Problem. It seems that it is only possible to set the Points property when the Signaturepad is visible. so my new code looks like this:

            List<Strokes> DBStrokes = SqLiteHelper.conn.Query<Strokes>("select * from Strokes where airid = ? order by PointSequence", formField.pictFile);

            Xamarin.Forms.Point[] points = new Point[DBStrokes.Count];

            for (int i = 0; i < DBStrokes.Count; i++)
                points[i] = new Point(DBStrokes[i].pointx, DBStrokes[i].pointy);

            var originalPoints = JsonConvert.SerializeObject(points);

            Xamarin.Forms.Point[] points4View = JsonConvert.DeserializeObject<Xamarin.Forms.Point[]>(originalPoints);

            signatureView.Points = points4View; 

Now i'm using the Handle_MeasureInvalidated - Event to run this code.

Klaus Grosche
  • 85
  • 1
  • 7