-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
Also, it looks like there is no dimming effect on android (for the page behind the popup). |
Beta Was this translation helpful? Give feedback.
-
Closed as per the Community Stand-up discussion here: https://youtu.be/N9wMcBP4jtg?t=2889 where it was agreed that New Features need to get above 7 upvotes within 6 months to progress to being reviewed by the maintainers. If you feel this is being closed in error please let us know and we can re-open. |
Beta Was this translation helpful? Give feedback.
-
@CliffAgius Why do you close my question instead of answering it? |
Beta Was this translation helpful? Give feedback.
-
It read to me as a Feature Request which didn't get the community support to progress to being discussed by the maintainers on the monthly meet-up. However reading again I see you mean as a question rather than a request. @bijington was the lead on the Popup Service he may know if there was a reason this was not implemented. I have re-opened the discussion for now. |
Beta Was this translation helpful? Give feedback.
-
To reinforce what @pictos mentioned, you can animate the content of a Popup. Here's an example where I use a bottom sheet-like entry and exit animation.
<!-- AnimPopup.xaml -->
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup
x:Class="Maui.StackOverflow.AnimPopup"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
VerticalOptions="End"
Color="Transparent">
<Grid HeightRequest="200" WidthRequest="600">
<Border
x:Name="content"
BackgroundColor="#ffe"
Loaded="OnAnimateEntry"
StrokeShape="RoundRectangle 10, 10, 0, 0"
TranslationY="200">
<VerticalStackLayout Padding="10" Spacing="20" VerticalOptions="Center">
<Label HorizontalOptions="Center" Text="Hello, World!" />
<Button Clicked="OnAnimateExit" HorizontalOptions="Center" Text="Done" />
</VerticalStackLayout>
</Border>
</Grid>
</toolkit:Popup> // AnimPopup.xaml.cs
using CommunityToolkit.Maui.Views;
namespace Maui.StackOverflow;
public partial class AnimPopup : Popup
{
public AnimPopup()
{
InitializeComponent();
}
async void OnAnimateEntry(object sender, EventArgs e)
{
await content.TranslateTo(0, 0, 250, Easing.CubicIn);
}
async void OnAnimateExit(object sender, EventArgs e)
{
await content.TranslateTo(0, 200, 250, Easing.CubicOut);
await this.CloseAsync();
}
} You don't have to limit yourself to
<!-- AnimPopup.xaml -->
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup
x:Class="Maui.StackOverflow.AnimPopup"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
Color="Transparent">
<Grid HeightRequest="200" WidthRequest="400">
<Border
x:Name="content"
BackgroundColor="#ffe"
Loaded="OnAnimateEntry"
Opacity="0"
Scale="0"
StrokeShape="RoundRectangle 10, 10, 10, 10">
<VerticalStackLayout
Padding="10"
Spacing="20"
VerticalOptions="Center">
<Label HorizontalOptions="Center" Text="Hello, World!" />
<Button
Clicked="OnAnimateExit"
HorizontalOptions="Center"
Text="Done" />
</VerticalStackLayout>
</Border>
</Grid>
</toolkit:Popup> // AnimPopup.xaml.cs
using CommunityToolkit.Maui.Views;
namespace Maui.StackOverflow;
public partial class AnimPopup : Popup
{
public AnimPopup()
{
InitializeComponent();
}
async void OnAnimateEntry(object sender, EventArgs e)
{
await Task.WhenAll(new Task[] {
content.ScaleTo(1, 250, Easing.CubicIn),
content.FadeTo(1, 250, Easing.CubicIn)
});
}
async void OnAnimateExit(object sender, EventArgs e)
{
await Task.WhenAll(new Task[] {
content.ScaleTo(0, 250, Easing.CubicOut),
content.FadeTo(0, 250, Easing.CubicOut)
});
await this.CloseAsync();
}
} Refer to the documentation and choose an animation that suits your needs. References: |
Beta Was this translation helpful? Give feedback.
-
So no out of the box animations ? |
Beta Was this translation helpful? Give feedback.
what do you mean by you can't animate the Popup? xP
So, being very specific you can't animate the
Popup
because it's anElement
, but you can animate itsContent
(that's a View).Here's the code snippet that makes it work
Screenbits.2024-09-05_005339.mp4