1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Enable visual styles in WPF application

Discussion in 'Programming & Webmastering' started by MrSeanKon, Nov 30, 2012.

  1. MrSeanKon

    MrSeanKon New Member

    Joined:
    Nov 14, 2006
    Messages:
    267 (0.09/day)
    Thanks Received:
    69
    Location:
    Athens in love with Anna :)
    I also find this but it does not work too.
    Source code is simple; it does not enable visual styles.
    Am I wrong?? :rolleyes: :rolleyes:

    Attached Files:

    Last edited: Dec 7, 2012
  2. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,331 (6.31/day)
    Thanks Received:
    3,358
    Location:
    IA, USA
    I think WPF is incompatible with Visual Styles. Visual Styles is for WinForms. WPF is an entirely different animal.
    Crunching for Team TPU
  3. MrSeanKon

    MrSeanKon New Member

    Joined:
    Nov 14, 2006
    Messages:
    267 (0.09/day)
    Thanks Received:
    69
    Location:
    Athens in love with Anna :)
    EUREKA!

    Steps:
    1) I made a Windows form (HostWPF namespace, Form1 is the form).
    2) I added a reference => System.Windows.Forms.Integration which contains classes that enable interoperation between the Windows Forms and WPF technologies. When you use System.Windows.Forms.Integration classes, you can host Windows Forms controls on WPF pages, and WPF elements in Windows Forms-based applications.
    3) Then added a control (damn Vi$ual $tudio 2010 does not allow to add a WPF window) but after adding I edited the XMAL code in the way I want ;)
    4) The next steps are simple. Download the first attachment. But => see the photo.
    It crashes!!!!!
    5) Finally???
    We must use System.Windows.Forms.Application.Exit(); command because the WPF window behaves like a classical Windows Form.
    Download the second attachment. Note that the Windows form's name is Initial.
    Enjoy!

    Attached Files:

    Last edited: Dec 1, 2012
    FordGT90Concept says thanks.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page