Migrate from Xamarin.Forms SfCard to .NET MAUI SfCard

27 Dec 20232 minutes to read

To make the migration from the Xamarin SfCards to .NET MAUI SfCards easier, most of the APIs from the Xamarin SfCards were kept in the.NET MAUI SfCards. However, to maintain the consistency of API naming in the .NET MAUI SfCards, some of the APIs have been renamed. Please find the difference in the following topics.

Namespaces

Xamarin SfCards .NET MAUI SfCards
Syncfusion.SfCards.XForms Syncfusion.Maui.Cards

Initialize control

To initialize the control, import the calendar namespace and initialize SfCalendar as shown in the following code sample.

Xamarin SfCards .NET MAUI SfCards
<ContentPage xmlns:cards="clr-namespace:Syncfusion.XForms.Cards;assembly=Syncfusion.Cards.XForms">

<cards:SfCardView>
	<Label Text="SfCardView"/>
</cards:SfCardView>

</ContentPage>
using Syncfusion.Cards.XForms;
...

SfCardView cardView = new SfCardView();

//set Content for card view
cardView.Content = new Label(){ Text="SfCardView" };

this.Content = cardView;
<ContentPage  xmlns:card="clr-namespace:Syncfusion.Maui.Cards;assembly=Syncfusion.Maui.Cards">

<card:SfCardView x:Name="sfCardView">
	<Label Text="SfCardView"/>	 
</card:SfCardView>

</ContentPage>
using Syncfusion.Maui.Cards;
...

SfCardView cardView = new SfCardView();

cardView.Content = new Label(){ Text="SfCardView" };

this.Content = cardView;

Properties

SfCards

The following code example, explains how to initialize the properties of the Xamarin SfCards and .NET MAUI SfCards class.

Xamarin SfCards .NET MAUI SfCards Description
Nil

BorderWidth

Gets or sets the stroke size in SfCardView
Nil

BorderColor

Gets or sets the stroke in SfCardView.

IsDismissed

IsDismissed

Gets or sets a card is dismissed or not.

CornerRadius

CornerRadius

Gets or sets the corner radius value in SfCardView.

IndicatorColor

IndicatorColor

Gets or sets the indicator color in SfCardView.

IndicatorThickenss

IndicatorThickenss

Gets or sets the indicator thickness in SfCardView.

IndicatorPosition

IndicatorPosition

Gets or sets the indicator position in SfCardView.

SwipeToDismiss

SwipeToDismiss

Gets or sets the swipe to dismiss value in SfCardView.

FadeOutOnSwiping

FadeOutOnSwiping

Gets or sets the Fade out value in SfCardView.

SwipeDirection

SwipeDirection

Gets or sets the swipe direction value in SfCardLayout.

ShowSwipedCard

ShowSwipedCard

Gets or sets the swiped card value in SfCardLayout.

VisibleCardIndex

VisibleIndex

Gets or sets the visible index value in SfCardLayout.
Nil

VerticalCardSpacing

Gets or sets the vertical space value in SfCardLayout.
Nil

HorizontalCardSpacing

Gets or sets the horizontal space value in SfCardLayout.

Events

Xamarin SfCards .NET MAUI SfCalendar Description

CardTapped

Tapped

Occurs whenever the card tapped on SfCardLayout.

VisibleCardIndexChanged

VisibleIndexChanged

Occurs whenever the card visible index changed on SfCardLayout.

VisibleCardIndexChanging

VisibleIndexChanging

Occurs whenever the card visible index changing on SfCardLayout.

Dismissed

Dismissed

Occurs whenever the card dismissed on SfCardView.

Dismissing

Dismissing

Occurs whenever the card dismissing on SfCardView.

Methods

Xamarin SfCards .NET MAUI SfCards Description

Forward

Forward

Move to next card.

Backward

Backward

Move to previous card.

Upcoming Features

  • Shadow effect support.