views:

20

answers:

1

I have some WinForms controls that I need to use in a WPF window. I'm able to get the controls to show up just fine and everything works as I would expect, but I'm experiencing one issue: all the WinForms controls are unstyled.

I'd like for the WinForms controls to at least use the default OS style (like I would see in a WinForms application). Is there any way to control this, or do I have to live with the controls the way they are?

+2  A: 

The WinForms controls can't use the WPF styles, because Windows Forms doesn't understand the WPF styling and templating system.

To get them to use the "OS style" (the OS visual theme), try calling System.Windows.Forms.Application.EnableVisualStyles in your Main method. (I thought WPF handled this automatically, but I guess that's not what you're seeing.) This must be called before any controls get created!

itowlson
Yeah, I realize that they can't use the WPF styles. Let me try your suggestion.
Ed Altorfer
Well, would you look at that. Worked like a charm! I can't believe I didn't think to try that.
Ed Altorfer