Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. WindowsFormsHost invalid theme in WPF Application (.Net 3.5)

WindowsFormsHost invalid theme in WPF Application (.Net 3.5)

Scheduled Pinned Locked Moved WPF
csharpquestionwpfwinformshelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mehdi Ghiasi
    wrote on last edited by
    #1

    Dear Friends. I've making a wpf application. in a part of my program, I need some "windows forms" controls. I use WindowsFormsHost for using that controls. it work correctly, but the theme of controls (in windowsformshost) is windows classic. but I using Windows Aero (Windows 7). Here is an Image of my Problem: http://ghiasi.net/wpf.jpg[^] How can i correct the theme of Windows Forms Controls in WPF Application?

    Regards. Mehdi Ghiasi

    P M 2 Replies Last reply
    0
    • M Mehdi Ghiasi

      Dear Friends. I've making a wpf application. in a part of my program, I need some "windows forms" controls. I use WindowsFormsHost for using that controls. it work correctly, but the theme of controls (in windowsformshost) is windows classic. but I using Windows Aero (Windows 7). Here is an Image of my Problem: http://ghiasi.net/wpf.jpg[^] How can i correct the theme of Windows Forms Controls in WPF Application?

      Regards. Mehdi Ghiasi

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Windows Forms controls use a different method of rendering to WPF (they use GDI+). If you want the forms to have the theme, you'll either have to invest in a 3rd party control that does this or write your own theme management. Alternatively, you could use native WPF controls; for instance the colour drop down will be easily achieved by setting the display template for the control to show a coloured rectangle with a textblock beside it. The numeric spin control is included in a MS sample here[^].

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      1 Reply Last reply
      0
      • M Mehdi Ghiasi

        Dear Friends. I've making a wpf application. in a part of my program, I need some "windows forms" controls. I use WindowsFormsHost for using that controls. it work correctly, but the theme of controls (in windowsformshost) is windows classic. but I using Windows Aero (Windows 7). Here is an Image of my Problem: http://ghiasi.net/wpf.jpg[^] How can i correct the theme of Windows Forms Controls in WPF Application?

        Regards. Mehdi Ghiasi

        M Offline
        M Offline
        mattjfenner
        wrote on last edited by
        #3

        just call "System.Windows.Forms.Application.EnableVisualStyles();" in the constructor of your Window and it will fix it.

        M 1 Reply Last reply
        0
        • M mattjfenner

          just call "System.Windows.Forms.Application.EnableVisualStyles();" in the constructor of your Window and it will fix it.

          M Offline
          M Offline
          Mehdi Ghiasi
          wrote on last edited by
          #4

          Thanks a lot!!!!!!!! ;)

          Regards. Mehdi Ghiasi

          M 1 Reply Last reply
          0
          • M Mehdi Ghiasi

            Thanks a lot!!!!!!!! ;)

            Regards. Mehdi Ghiasi

            M Offline
            M Offline
            mattjfenner
            wrote on last edited by
            #5

            I thought you might like that answer better than the other guy's :) (no offence to the other guy)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups