How do I create basic animations in .NET MAUI?

Platform: .NET MAUI| Category: General

You can create a basic animation using the ViewExtensions class. Here’s an example of a simple fade-in animation for a Label:

XAML

<Label x:Name="animatedLabel" Text="Hello, .NET MAUI!" Opacity="0" />
<Button Text="Animate" Clicked="OnAnimateClicked" WidthRequest="200" />

C#

async void OnAnimateClicked(object sender, EventArgs e)
{
   //whenever the button is clicked
   await BasicAnimation(animatedLabel);
}
async Task BasicAnimation(View view)
{
   await view.FadeTo(1, 1000);
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.