Search code examples
xamlxamarinsignaturepad

how to put constant height for my signature pad irrespective of orientation?


In a xamarin app, i have created a signature pad , and i have kept margin like

i want to keep a permanent heigh for the signature area irrespective of device and orientation,

i am not xamarin developer, And i dont have idea about xaml, still I tried Margin="200,200,200,200" , but it behaves weirdly when i change orientation.

in ipad in landscape mode the area is not at all visible.

<?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:signaturePad="clr-namespace:Acr.XamForms.SignaturePad;assembly=Acr.XamForms.SignaturePad"
             x:Class="watebook.Clients.Mobile.Views.CaptureSignature"
             BackgroundColor="{StaticResource PageBackgroundColor}">

    <AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
        <StackLayout AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1">
            <ContentView Style="{StaticResource PageHeaderBodySeparator}" />
            <signaturePad:SignaturePadView
            Margin="200,200,200,200"
            VerticalOptions="FillAndExpand"
            HorizontalOptions="FillAndExpand"
            x:Name="padView"
            BackgroundColor="{StaticResource SignaturePadBackgroundColor}"
            CaptionText="Please sign here"
            CaptionTextColor="{StaticResource SignaturePadCaptionTextColor}"
            PromptText="."
            SignatureLineColor="{StaticResource SignaturePadSignatureLineColor}"
            StrokeColor="{StaticResource SignaturePadSignatureStrokeColor}"
            StrokeWidth="2"
            ClearText="" />
            <Button Text="SAVE SIGNATURE" Clicked="Button_OnClicked" BackgroundColor="#ffd300" TextColor="Black" x:Name="SaveButton" BorderColor="Black" Margin="0,10,0,300" />
        </StackLayout>
        <ContentView Style="{StaticResource ProcessIndicatorContentViewStyle}" x:Name="ActivityCameraIndicators" IsVisible="False" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1">
            <Label Style="{x:StaticResource ProcessIndicatorLabelStyle}" Text="Processing" x:Name="ActivityIndicatorLable" />
        </ContentView>
    </AbsoluteLayout>
</ContentPage>

How to keep a permanent height for my signature pad?


Solution

  • use HeightRequest

    <signaturePad:SignaturePadView HeightRequest="200" ... />