Question

From what I understand so far, the InkCanvas element is in the WPF Framework. To use that, I need an ElementHost control to host the InkCanvas element. I've been to the MSDN links, but the example it gives talks of creating a WPF User Control Library project and so on. It's not that bad, but it seems a bit much to just add a control to a Winform. Is there a simpler way to do this, or am I trying to oversimplify this?

Thanks.

Was it helpful?

Solution

This should work:

ElementHost host = new ElementHost();
InkCanvas ic = new InkCanvas();
host.Child = ic;
Controls.Add(host);

As mentioned in comments, one needs to add the WPF assemblies as reference (WindowsBase, PresentationCore, PresentationFramework).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top