2
votes

I have added the Nuget packages for Xamarin.Controls.SignaturePad.Forms into my xamarin forms solution. I call the GetImageStreamAsync(SignatureImageFormat.Jpg);. When I run it with White background and black stroke color it only works on ios. Android displays a black screen. THen when I try to set the background to black and White stroke color, Android displays correctly and ios displays a white block and doesn't display correctly. Does anyone have any solutions to this? Ideally it would be good to have the same background color and stroke color on either platforms. I can get around it by setting the background color and stroke color depending on OS, but that seems a bit hacky. Here's what works with the android in Xamarin Forms when I call var str = await PadView.GetImageStreamAsync(SignatureImageFormat.Jpg);. Setting a "White" Background doesn't show up in Android. It always shows a black square. Is there something I'm missing? I'm trying the source https://github.com/xamarin/SignaturePad Thanks.

 <forms:SignaturePadView x:Name="PadView"
                                       HeightRequest="100"
                                       WidthRequest="140"
                                       BackgroundColor="Black"
                                        SignatureLineColor="White" 
                                       PromptText="Sign here"
                                       PromptTextColor="Gray"
                                       ClearText="Clear"
                                       ClearTextColor="{StaticResource Accent}"
                                       StrokeColor="White"
                                       StrokeWidth="4" />
1
Ended up rebuilding the SignaturePad source and setting the image background to whitedayzee

1 Answers

1
votes

see comment - Rebuilt source and hard coded White into android background color when it creates the image of the signature. It suits what I have to do, so may not work if you want another color, or you may have to hard code your own color in the android and ios version. Didn't delve into the SignaturePad code enough to see what was going on.