Hi All,
I'm storing a signature (by serializing points) in a database and then attempting to recreate the signature... and it's not going to plan. A snippet of my code is below
Code Behind
private async void SaveButton_Clicked(object sender, EventArgs e)
{
string points_string = JsonConvert.SerializeObject(PadView.Points.ToArray());
// store to db, fetch
Xamarin.Forms.Point[] points = JsonConvert.DeserializeObject<Xamarin.Forms.Point[]>(points_string);
SignaturePadCanvasView sig = new SignaturePadCanvasView();
sig.Points = pnts;
// img is null at this point
Stream img = await sig.GetImageStreamAsync(SignatureImageFormat.Png);
// do something with the stream, in my case add to a padf
}
XAML
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:H1PaperlessApp"
xmlns:forms="clr-namespace:SignaturePad.Forms;assembly=SignaturePad.Forms"
x:Class="H1PaperlessApp.Views.Temppage"
Padding="10">
<StackLayout>
<forms:SignaturePadView x:Name="PadView"
HeightRequest="350"
WidthRequest="240"
BackgroundColor="White"
StrokeColor="Black"
StrokeWidth="2"/>
<Button Text="Save" FontSize="30" BackgroundColor="DodgerBlue" TextColor="White"
Clicked="SaveButton_Clicked"/>
</StackLayout>
</ContentPage>
My problem is that GetImageStreamAsync is returning null and I can't work out why. Any suggestions?