Can I add an ElementHost to a regular WinForm StatusStrip?

170 Views Asked by At

I just started learning WPF, and I've been trying to add this WPF control to a regular WinForm.

I know I can use Forms.Integration.ElementHost to host WPF controls in a WinForm. But as StatusStrip takes Items and not Controls it's marking the ElementHost as incompatible.

Do I need to replace the entire StatusStrip with WPF ToolBar for this to work?

1

There are 1 best solutions below

1
On BEST ANSWER

You can use ToolStripControlHost to add any control to the strip. For example for an element host which hosts a wpf user control, you can use this code:

var host = new ToolStripControlHost(this.elementHost1);
this.statusStrip1.Items.Add(host);