xamarin.android - How to bind signature byte array on signature pad xamarin forms? -
i have signature pad in xamarin forms app. user sign on signature pad , moves next screen. when user come on signature pad screen, previous signature gets remove signature pad. how can set signature should not delete until user @ current state of app?
i save signature value byte array when user moves next screen. can bind byte array @ signature pad show signature?
regards, anand dubey
since xamarin forms, i'm assuming you're using allan ritchie's acr.xamforms.signaturepad
classes.
the signaturepadview
class exposes method: loaddrawpoints
, allows load signature data view. since method, can't databind it, can add code hosting view load signature:
// note: below assumes // a) you're using mvvm (as should :) ) // b) viewmodel class name myviewmodelclassname (change appropriately) // c) property on vm exposes signature points named signaturepoints (change appropriately) protected override onappearing() { loadsignature(); } protected override onbindingcontextchanged() { loadsignature(); } private void loadsignature() { var vm = this.bindingcontext myviewmodelclassname; if (vm != null && vm.signaturepoints != null) { this.signaturepadview.loaddrawpoints(vm.signaturepoints); } }
lastly, mention you're saving signature byte array; above code assumes it's array of drawpoint
, pair of floats, you'd need reverse whatever conversion you're doing.
Comments
Post a Comment