0

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.

3
  • Did you try something like this: ElementHost host = new ElementHost(); InkCanvas ic = new InkCanvas(); host.Child = ic; Controls.Add(host);?
    – Vlad
    Oct 18, 2013 at 15:47
  • Once I added the references to the needed assemblies, it was that easy. Thanks, @Vlad.
    – RHelm
    Oct 18, 2013 at 19:03
  • Glad that that helped. I'll copy the comment to an answer for other's reference.
    – Vlad
    Oct 18, 2013 at 19:40

1 Answer 1

0

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.