Question: [Using Composition with Canvas]
See original GitHub issueHello,
I want to build a desktop app with WinUI3, to allow draw some simple diagrams like flowsheet, etc, show texts along with lines or blocks.
in WPF I can either inherit from DrawingVisual object or Shape object. but I don’t find enough examples to do this in C++/WinRT + WinUI3.
Question 1: what’s the proper way to do it in WinUi3? I’m trying to use Microsoft.UI.Composition to do this, but I don’t find a similar class like DrawingVisual, in WPF by inherit DrawingVisual, I can draw shapes or paths and render text in derived classes.
Question 2: should I use Microsoft.UI.Xaml.Shapes.Shape class as base instead? 2000 lines might be expected as the worst case in the future, to be zoomed in or out, or moved , selected something like that. is there any performance concern if I use Microsoft.UI.Xaml.Shapes.Shape ?
Question 3: should I use Microsoft.UI.Composition.CompositionSpriteShape as base class? or other class(please advise), if so, should it be a runtimeclass ,or just a normal C++ class? is *.idl file required?
Question 4: I want to render text along with these shapes, what’s the right way to do so. just simple description is fine to me.
too less resource in C++/WinRT, what a pity… I have found some like this, and now just trying to do it in C++/WinRT.
Thank you!
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)

Top Related StackOverflow Question
Win2D is a good Option. Just drawing on a SwapChainPanel. See Introduction or Win2D-WinUI3 WithoutControls
Another option: https://github.com/microsoft/Win2D