Validate if the image is empty
I want to know how I can validate if the signature has been placed ?
using static Android.Provider.MediaStore;
namespace MRSApp.WorkOrders;
public partial class SignaturePage : ContentPage
{
public SignaturePage()
{
InitializeComponent();
}
// Close Page
private async void Cerrar_Clicked(object sender, EventArgs e)
{
await Navigation.PopModalAsync();
}
// Save Image
private void Save_Clicked(object sender, EventArgs e)
{
}
// Clear Image
private void Clear_Clicked(object sender, EventArgs e)
{
signaturePad.Clear();
}
}
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:signaturePad="clr-namespace:Syncfusion.Maui.SignaturePad;assembly=Syncfusion.Maui.SignaturePad"
x:Class="MRSApp.WorkOrders.SignaturePage"
Title="Signature">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <!-- Título y botón de cerrar -->
<RowDefinition Height="Auto"/> <!-- Entry para el nombre -->
<RowDefinition Height="*"/> <!-- SfSignaturePad -->
<RowDefinition Height="Auto"/> <!-- Botones Save y Clear -->
</Grid.RowDefinitions>
<!-- Frame con botón de cierre -->
<Frame BackgroundColor="Green" Padding="10" CornerRadius="5" HeightRequest="40">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Text="Signature" TextColor="White" HorizontalOptions="Center" VerticalOptions="Center" />
<Button ImageSource="boton_close.png" Clicked="Cerrar_Clicked" BackgroundColor="Transparent" HorizontalOptions="End" VerticalOptions="Center" Grid.Column="1" />
</Grid>
</Frame>
<!-- Entry para el nombre en letra de molde -->
<Entry Grid.Row="1" Placeholder="Name in print" Margin="10" PlaceholderColor="DarkGray"/>
<!-- SfSignaturePad -->
<Frame Grid.Row="2" BorderColor="Gray" Padding="3" CornerRadius="10" Margin="10">
<signaturePad:SfSignaturePad
x:Name="signatureFirmaPad"
StrokeColor="Blue"
BackgroundColor="White"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"/>
</Frame>
<!-- Botones Save y Clear -->
<Grid Grid.Row="3" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Text="Save" Clicked="Save_Clicked" HorizontalOptions="FillAndExpand" Margin="10,0,5,0"/>
<Button Text="Clear" Clicked="Clear_Clicked" HorizontalOptions="FillAndExpand" Grid.Column="1" Margin="5,0,10,0"/>
</Grid>
</Grid>
</ContentPage>
Hi EDGAR GARCIA,
We have reviewed your query and currently we don’t have support for validating the Signature in SfSignaturePad, we have already created a feature request to "Add IsEmpty property in SfSignaturePad". Please find the link below to track the status of the feature implementation.
Feedback link: Add IsEmpty property in SfSignaturePad
Please cast your vote to make it count. We will prioritize the features every release based on the demands and we do not have an immediate plan to implement this feature since we have committed to already planned work. So, this feature will be available in any of our upcoming releases.
If you have any more specifications/suggestions for the feature request, you can add them as a comment in the portal. We will share the release details in the feedback itself.
Currently, to address your query, we have prepared a sample to meet your requirement at the sample level. In the sample, we utilize the DrawCompleted event to capture the signature and then assign the signature to the Image Source for validation. We have attached the sample for your reference.
Please review the attached sample and let us know if you have any further queries or concerns.
Regards,
Kamalesh P
Attachment: SignaturePadSample_1c432bd.zip
- 1 Reply
- 2 Participants
-
EG EDGAR GARCIA
- Mar 20, 2024 03:14 PM UTC
- Mar 21, 2024 01:34 PM UTC