Category / Section
How to reveal a back layer based on a gesture in a Xamarin.Forms application
1 min read
This section explains how to programmatically open and close FrontLayer of SfBackdropPage in Xamarin.Forms.
Refer to this Getting Started documentation, to create a simple sample with BackDropPage control.
Consider the below use case of revealing back layer content of SfBackdropPage based on the button click event in a Xamarin.Forms application.
This can be achieved by enabling IsBackLayerRevealed property of SfBackdropPage as shown in below code snippet
XAML
<backdrop:SfBackdropPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:backdrop="clr- namespace:Syncfusion.XForms.Backdrop;assembly=Syncfusion.SfBackdrop.XForms" x:Class="BackDropPage.Drop" BackLayerRevealOption="Auto"> <backdrop:SfBackdropPage.BackLayer> <backdrop:BackdropBackLayer > <ListView HeightRequest="250"> <ListView.ItemsSource> <x:Array Type="{x:Type x:String}"> <x:String>01 JAN : New Year</x:String> <x:String>16 JAN : Release Day</x:String> <x:String>10 APR : Good Friday</x:String> <x:String>25 DEC : Christmas</x:String> </x:Array> </ListView.ItemsSource> </ListView> </backdrop:BackdropBackLayer> </backdrop:SfBackdropPage.BackLayer> <backdrop:SfBackdropPage.FrontLayer> <backdrop:BackdropFrontLayer> <Grid > <Label Text="Upcoming Holidays"/> <Button Text="🗓" Grid.Column="1" HorizontalOptions="End" Clicked="Button_Clicked" BackgroundColor="Transparent" /> </Grid> </backdrop:BackdropFrontLayer> </backdrop:SfBackdropPage.FrontLayer> </backdrop:SfBackdropPage>
C#
public partial class Drop : SfBackdropPage{ private void Button_Clicked(object sender, EventArgs e) { IsBackLayerRevealed = true; }}
Note:
By default, IsBackLayerRevealed property is set as false.
For more available options in Reveal and Conceal of back layer, Refer link.
Also Refer our feature tour page to know more about the features available in our back drop page.