Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question CanvasAnimatedControl #923

Open
JohnThimon opened this issue May 28, 2023 · 4 comments
Open

Question CanvasAnimatedControl #923

JohnThimon opened this issue May 28, 2023 · 4 comments
Labels

Comments

@JohnThimon
Copy link

I have a project I've been working on for years as an uwp app with win2d and CanvasAnimatedControl. Now I can't really progress anymore because I need to move up in .net version and C# version and with that leave uwp for winui3.

I've been waiting for ages to get any kind of information about if CanvasAnimatedControl will be added for winui3 and I'm about to give up, so either scrap my project or start over with something completely different.

Is there any news on this? will it be done or is it dead?

Regards

John

@Sergio0694
Copy link
Member

Hey there! Making CanvasAnimatedControl available for WinUI 3 is still planned, though there isn't an ETA on when that will be available. If you want to display animations or other general realtime content in your app with Win2D, you can:

  • Use a CanvasSwapChain directly (CanvasAnimatedControl uses it behind the scenes). This will be more complicated than using CanvasAnimatedControl though, as you'll have to manually manage your render thread, inputs, DPI scaling, etc.
  • Remain on UWP (at least for now), and use CanvasAnimatedControl.

Option (2) is likely the easiest (and you can always migrate at a later time).
For the C# part, if it helps, you can still enable C# 11 even on UWP. You could also use PolySharp to enable some of the new language features there as well (eg. records, pattern matching, etc.). Of course, that's not the same as having modern C# on modern .NET (you still miss out on some features, like static abstracts), but it's still much better than being stuck at C# 7.3 like the default UWP template does 🙂

Hope this helps!

@JohnThimon
Copy link
Author

I will look into CanvasSwapChain while waiting for CanvasAnimatedControl.

What I really need is better performance with garbage collecting, and I hope there is some in newer .net and C#. CanvasAnimatedControl gets noticeable frame drops when GC is running. I have managed to optimize my code so it's almost good enough, so just a little improvement would be good for my app. I guess this is the cost of using a managed language for something like this.

@Slion
Copy link

Slion commented Sep 27, 2024

I too was hoping to use CanvasAnimatedControl on WinUI and landed here. Looks like it's still not available then. I'll just do some invalidate for now I guess.

@Sergio0694
Copy link
Member

It's available in the latest preview package for WinAppSDK 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants