New to Telerik UI for Xamarin? Download free 30-day trial

Events

The SignaturePad for Xamarin exposes the following events:

  • StrokeStarted event is raised when a new stroke is started. The StrokeStarted event handler receives two parameters:

    • The Sender which is of type Telerik.XamarinForms.Input.SignatureView.
    • and EventArgs
  • StrokeCompleted event is raised when a new stroke is completed. The StrokeCompleted event handler receives two parameters:

    • The Sender which is of type Telerik.XamarinForms.Input.SignatureView.
    • and EventArgs
  • Cleared event is raised when the surface of Telerik.XamarinForms.Input.RadSignaturePad is cleared

Example

The example contains a X Button, two Labels and a SignaturePad. The control's definition in XAML:

<telerikInput:RadSignaturePad x:Name="signaturePad" BorderThickness="1" 
                              BorderColor="LightGray"
                              StrokeStarted="RadSignaturePad_StrokeStarted"
                              StrokeCompleted="RadSignaturePad_StrokeCompleted"
                              Cleared="RadSignaturePad_Cleared"/>

<Button x:Name="clearButton" 
        Text="X" 
        BackgroundColor="Transparent" 
        Command="{Binding Source={x:Reference signaturePad}, Path=ClearCommand}" 
        HorizontalOptions="End" 
        VerticalOptions="Start" 
        Margin="0,10,10,0"/>

<Label x:Name="timeStampLabel" 
       HorizontalOptions="End"
       VerticalOptions="End" 
       Margin="0,0,10,10"/>

Add the following namespace:

xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"

Let's add the events:

The SignaturePad.StrokeStarted event. When stroke starts we will display a timestamp using a Label:

private void RadSignaturePad_StrokeStarted(object sender, EventArgs e)
{
    this.timeStampLabel.Text = DateTime.Now.ToString();
    this.logInfo.Text = "";

}

The SignaturePad.StrokeCompleted event. When stroke completes the timespamp Label text is udated.

private void RadSignaturePad_StrokeCompleted(object sender, EventArgs e)
{
    this.timeStampLabel.Text = DateTime.Now.ToString();
}

The SignaturePad.Cleared event, When Cleared event is fired, Label with Text="Cleared" is displayed.

private void RadSignaturePad_Cleared(object sender, EventArgs e)
{
    this.logInfo.Text = "Cleared";
    this.timeStampLabel.Text = "";
}

SignaturePad Events

See Also

In this article