locked
How to set environment variable to Vista RRS feed

  • Question

  • I have a wpf windows app that will be running mostly on winxp machines and I want everything to look as much as possible like vista.  How can I set the environment variable to Vista so system objects like windows, buttons, etc. will have the Vista look and feel?

    Wednesday, March 28, 2007 5:45 PM

Answers

  • Windows XP has no knowledge of Vista, and thus cannot natively replicate the Vista interface.

     

    -Ryan / Kardax

    Wednesday, March 28, 2007 6:13 PM
  • It's not an environment variable.  This is done via themes.  You can import the Vista theme, or any other theme, quite easily.  The following post gives some indication on how to do this.

    http://arbel.net/blog/archive/2006/11/03/Forcing-WPF-to-use-a-specific-Windows-theme.aspx

    Regards
    Neil
    Thursday, March 29, 2007 12:21 AM
  • Allowing an application to set its own theme is something that has been requested from time to time. There are a few things, though, that go to the reasoning why this wasn't made as easy as one might like.

     

    1. Respecting end-user settings. If an end-user needs high contrast in order to use UI, the system will switch to Windows Classic and set the colors to be high contrast. If an application forces itself to be a certain theme, such as Aero which in places is too subtle for some users to read, the application may be unusable for those users.

     

    2. Consistent with system settings. This is what I mentioned before in that the theme will reference other system settings, which may not end up with a desired result.

     

    3. Identity. Windows XP, Windows Vista, Office 2003, and Office 2007 all have different looks. This builds their identity. When I look at a UI that has Luna controls, I expect Windows XP. When I see Aero controls, I expect Windows Vista. Seeing Luna on Windows Vista is jarring. Likewise, seeing Aero on Windows XP can be jarring, even though (for now) it's considered "cool."

     

    So, the point is that if an application author is going to deviate from the system theme, it should be done deliberately and with care, taking into account the variety of needs of the end-user. WPF's theming system today allows authors to create these different looks for different themes, but it does not do any automatic conversion of one theme to fit while another is the current system setting.

     

    It sounds like, though, that if we were to add a variety of resources either in the SDK or in designers like the Expression line or products that provided some pre-built resources that allowed a variety of looks that would work in all of the pre-existing themes (i.e. an Aero-like theme that would work in high contrast), that might get you what you want. I can pass that along to the appropriate teams, if you think that would be useful.

     

    Ben

    Friday, March 30, 2007 6:06 PM

All replies

  • Windows XP has no knowledge of Vista, and thus cannot natively replicate the Vista interface.

     

    -Ryan / Kardax

    Wednesday, March 28, 2007 6:13 PM
  • Infragistics does this somehow when you load one of their libraries it makes all the forms and controls in the app have the same look and feel such as winxp, vista, office 2003, office 2007, etc.  I’m not using infragistics on this app (and they don’t have updates for wpf yet anyway).  Are there any code examples on how to do this?
    Wednesday, March 28, 2007 11:38 PM
  • It's not an environment variable.  This is done via themes.  You can import the Vista theme, or any other theme, quite easily.  The following post gives some indication on how to do this.

    http://arbel.net/blog/archive/2006/11/03/Forcing-WPF-to-use-a-specific-Windows-theme.aspx

    Regards
    Neil
    Thursday, March 29, 2007 12:21 AM
  • There are two things to keep in mind.

     

    1. System themes are independent of WPF. The Aero theme is not available on Windows XP (unless someone's hacked that).

    2. The theme resources provided by WPF have references to system parameters that are dependent on the system theme.

     

    So, while it is possible to do as described and load the WPF resources for a different theme, you may not achieve the actual intended look.

     

    Thursday, March 29, 2007 5:24 PM
  • I realize that certain aspects of Aero can not be done on XP such as the fonts, but probably much of it could be.  It would be nice if there was a theme resource we could use that would bring apps running on winXP closer to Aero and/or office 2007 running on vista.  It would be very helpful if I could focus on what I’m good at which is building applications, designing databases, etc. and have a resource to help me get the UIs looking great with out having to invent and develop everything from scratch.  I don’t have the resources to do that.  There’s probably millions of people just like me out there that need this as well.

     

    Thanks.

    Friday, March 30, 2007 5:22 PM
  • Allowing an application to set its own theme is something that has been requested from time to time. There are a few things, though, that go to the reasoning why this wasn't made as easy as one might like.

     

    1. Respecting end-user settings. If an end-user needs high contrast in order to use UI, the system will switch to Windows Classic and set the colors to be high contrast. If an application forces itself to be a certain theme, such as Aero which in places is too subtle for some users to read, the application may be unusable for those users.

     

    2. Consistent with system settings. This is what I mentioned before in that the theme will reference other system settings, which may not end up with a desired result.

     

    3. Identity. Windows XP, Windows Vista, Office 2003, and Office 2007 all have different looks. This builds their identity. When I look at a UI that has Luna controls, I expect Windows XP. When I see Aero controls, I expect Windows Vista. Seeing Luna on Windows Vista is jarring. Likewise, seeing Aero on Windows XP can be jarring, even though (for now) it's considered "cool."

     

    So, the point is that if an application author is going to deviate from the system theme, it should be done deliberately and with care, taking into account the variety of needs of the end-user. WPF's theming system today allows authors to create these different looks for different themes, but it does not do any automatic conversion of one theme to fit while another is the current system setting.

     

    It sounds like, though, that if we were to add a variety of resources either in the SDK or in designers like the Expression line or products that provided some pre-built resources that allowed a variety of looks that would work in all of the pre-existing themes (i.e. an Aero-like theme that would work in high contrast), that might get you what you want. I can pass that along to the appropriate teams, if you think that would be useful.

     

    Ben

    Friday, March 30, 2007 6:06 PM