WinUI3 support
Hi. I'm already using WinUI 3 in personal projects and production apps. And as I see - Lottie is not supported on this platform. There is no package CommunityToolkit.WinUI.Lottie.
And current package Microsoft.UI.Xaml.UWP.Lottie targets the UWP platform, that's why it's impossible to use Lottie in WinUI. Are there any plans for WinUI 3 support?
Hey @LeftTwixWand, I'm porting a UWP app to WinUI Desktop and have the same issue. I'm in the middle of the port but I was able to get around the compile issues using this:
-
Use LottieGen to generate CS code, something like:
LottieGen -Language CSharp -Public -WinUIVersion 3.0 -InputFile loading.json -
Add the Microsoft.Graphics.Win2D nuget package to my WinUI project:
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" /> -
Modified the generated code in loading.cs to fix a few compile issues: Changed this:
result = (IGeometrySource2D)(object)CanvasGeometry.CreatePath(builder);to this:result = CanvasGeometry.CreatePath(builder); -
Updated the XAML page by removing the lottie namespace and adding the animatedvisuals namespace.
-
Updated the XAML page by removing the lottie control and replacing it with this:
<muxc:AnimatedVisualPlayer.Source> <animatedvisuals:loading/> </muxc:AnimatedVisualPlayer.Source>
I don't know if this will actually work as I haven't been able to test it being in the middle of changes.
Hope this works for you.
@rainman-306 Thank You so much!
If in the few weeks this issue won't be fixed, I'll try to fix it by myself.
Hello,
Thank you for reaching out. We are currently investigating this.
I'd also love to see Lottie in WinUI 3, especially since the latest Windows designs emphasize animations much more than previously.
Bumping into this issue. We have iOS and Android apps using Lottie, and we would like to do the same with our WinUI 3 app.
Hey @LeftTwixWand, I'm porting a UWP app to WinUI Desktop and have the same issue. I'm in the middle of the port but I was able to get around the compile issues using this:
- Use LottieGen to generate CS code, something like:
LottieGen -Language CSharp -Public -WinUIVersion 3.0 -InputFile loading.json- Add the Microsoft.Graphics.Win2D nuget package to my WinUI project:
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />- Modified the generated code in loading.cs to fix a few compile issues: Changed this:
result = (IGeometrySource2D)(object)CanvasGeometry.CreatePath(builder);to this:result = CanvasGeometry.CreatePath(builder);- Updated the XAML page by removing the lottie namespace and adding the animatedvisuals namespace.
- Updated the XAML page by removing the lottie control and replacing it with this:
<muxc:AnimatedVisualPlayer.Source> <animatedvisuals:loading/> </muxc:AnimatedVisualPlayer.Source>I don't know if this will actually work as I haven't been able to test it being in the middle of changes.
Hope this works for you.
Thanks, it works! But in my side, IAnimatedVisual2 should also changed to IAnimatedVisual.
Hey @LeftTwixWand, I'm porting a UWP app to WinUI Desktop and have the same issue. I'm in the middle of the port but I was able to get around the compile issues using this:
- Use LottieGen to generate CS code, something like:
LottieGen -Language CSharp -Public -WinUIVersion 3.0 -InputFile loading.json- Add the Microsoft.Graphics.Win2D nuget package to my WinUI project:
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />- Modified the generated code in loading.cs to fix a few compile issues: Changed this:
result = (IGeometrySource2D)(object)CanvasGeometry.CreatePath(builder);to this:result = CanvasGeometry.CreatePath(builder);- Updated the XAML page by removing the lottie namespace and adding the animatedvisuals namespace.
- Updated the XAML page by removing the lottie control and replacing it with this:
<muxc:AnimatedVisualPlayer.Source> <animatedvisuals:loading/> </muxc:AnimatedVisualPlayer.Source>I don't know if this will actually work as I haven't been able to test it being in the middle of changes. Hope this works for you.
Thanks, it works! But in my side, IAnimatedVisual2 should also changed to IAnimatedVisual.
Thank you, this works! I wonder why this is still not fixed after two years, is lottie -windows is dead for winui 3? I also notice animations from lottiefiles.com are comnverted with many errors.
Thank you, this works! I wonder why this is still not fixed after two years, is lottie -windows is dead for winui 3? I also notice animations from lottiefiles.com are comnverted with many errors.
Another option is to download the Lottie as an animated GIF and use that in WINUI. Its not ideal but at least it renders properly on all platforms. I had to do that with my project because I'm building multiplatform app.
Any update on this? We have the same use-case: migrating from UWP to WinUI.
https://www.nuget.org/packages/CommunityToolkit.WinUI.Lottie#readme-body-tab
Any update on this?
Any update on this? We have the same use-case: migrating from UWP to WinUI.
Have you tried to use this? I am able to use is in Latest WinUI project with some changes.
@aqibbanday This https://www.nuget.org/packages/CommunityToolkit.WinUI.Lottie#readme-body-tab works. But you'll have to use x86 with the WinUI app for some reason, the x64 doesn't work.
@aborziak-ms is this something you can look at? @RudyHuyn hit this issue out today too.
Wondering if it has something to do with this extra configuration in the cake script?
https://github.com/CommunityToolkit/Lottie-Windows/blob/64fb023b8e5b758589efbb9935af3a29282167ac/build/build.cake#L71-L75
But not really sure, just guessing, we don't have this in the main toolkit script though (though we've moved away from cake now too for our new infrastructure). And I think with .NET it's still all just a single DLL anyway?
Also appears like the symbols aren't part of the package.
Nop. That was not the issue. It was simpler. A misconfiguration in the sln. I've fixed this on #530.