It is a well known fact that if you use the Microsoft.Win32.OpenFileDialog
from an WPF application you will have old fashioned buttons and icons. The
proposed solution to this problem (at least for ClickOnce applications) is to
put a certain paragraph into the .exe.manifest file
(http://bombayboy.wordpress.com/2006/09/09/wpf-avalon-clickonce-application-and-fileopendialog-2/):
<dependency>
<dependentAssembly>
<assemblyIdentity
type=”win32″
name=”Microsoft.Windows.Common-Controls”
version=”6.0.0.0″
processorArchitecture=”X86″
publicKeyToken=”6595b64144ccf1df”
language=”*”
/>
</dependentAssembly>
</dependency>
Other options proposed are: Try to use EnableVisualStyles where people
assume that this is not stable (SEHExceptions problems?). Or implement the
dialog yourself by using a "Vista Bridge" sample from the Windows SDK, which
probably works only on Vista systems.
(http://reader.feedshow.com/show_items-feed=d7f39942385afee366f96021e8eb6263?page=1).
Howerver, the majority votes for the manifest solution, but there seems to
be a serious drawback: On Windows XP 64 bit versions, there is no version of
Common Controls that matches this entry in the manifest file. There are wow64
and amd64 versions of CommonControls 6.0.x available but for applications
compiled for 32 bit none of them can be used. For 32 bit applications, only
version 5.8.x is available which makes it very risky to use the above
mentioned entry in the manifest file because the ClickOnce application will
crash at install time.
Is there really no better solution to display decent OpenFileDialogs in WPF?
Best regards,
Stefanie
Willy.
"Stefanie Mehl" <Stef...@nospam.nospam> wrote in message
news:10E8FA7B-6EAE-4A20...@microsoft.com...
> You should have both versions 5.xxx.yyy.zzzz and 6.xxx.yyy.zzz installed in
> winSxS, and this for both X86 and amd64.
It would be nice if this was the case, but on a freshly installed Windows
XP64, you find only the following versions of Common-Controls:
amd64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.3790.1830_x-ww_4D792D2A
amd64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.3790.3959_x-ww_AB06DEB0
amd64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.1830_x-ww_ACED72AF
amd64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_0A7B2435
wow64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.1830_x-ww_0213CDC8
wow64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_5FA17F4E
x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.3790.1830_x-ww_1B6F474A
x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.3790.3959_x-ww_78FCF8D0
As Microsoft themselves state that Common-Controls version 6 is not
redistributable (http://msdn2.microsoft.com/en-us/library/bb776779.aspx),
there is also not way to correct that situation - so this is obviously not an
option.
Best regards,
Stefanie
Willy.
"Stefanie Mehl" <Stef...@nospam.nospam> wrote in message
news:E5EACF5B-0EC9-4311...@microsoft.com...
yes, that is true, but somehow ClickOnce does not accept that as a correct
version for the manifest entry (missing policy?). Otherwise, I would not even
have realized that there could be a problem with missing versions.
Best regards,
Stefanie
Willy.
"Stefanie Mehl" <Stef...@nospam.nospam> wrote in message
news:BE1EA74C-3A5A-465F...@microsoft.com...
But thank you very much for your answers, Willy!
Willy.
"Stefanie Mehl" <Stef...@nospam.nospam> wrote in message
news:3B343FEA-39D6-42B0...@microsoft.com...
Could you try using this in your manifest
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"/>
</dependentAssembly>
</dependency>
Note the processorArchitecture value *, this instructs fusion to find a
correct match in WinSxS.
If this doesn't work (it does for me), could you try with WinSxS tracing
(SxSTrace.exe) enabled and inspect the output of the parsed trace file.
Willy.
"Stefanie Mehl" <Stef...@nospam.nospam> wrote in message
news:3B343FEA-39D6-42B0...@microsoft.com...
that could have been a good idea, but unfortunately it is not an allowed
value:
>>The 'processorArchitecture' attribute is invalid - The value '*' is invalid according to its datatype 'urn:schemas-microsoft-com:asm.v2:processorArchitectureType' - The Enumeration constraint failed.<<
The WindowsForms solution seems to work fine, since it even makes it
possible to have the Vista OpenFileDialog on Vista systems.
And here is the relevant part of the manifest I'm using..
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0"
xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"/>
</dependentAssembly>
</dependency>
...
Willy.
Note: I'm running this on Vista 64-bit and W2K3 64-bit SP2.
do you really use processorArchitecture="*" in your manifest? Because I got
an error message for that entry which I mentioned in my post.
Best regards,
Stefanie
Stefanie,
Yes I do, but as I said before I tried this on Vista-64 W2K3 SP2 and W2K8-64
only, XP64 is quite a bit older, so I wouldn't be surprised that the
manifest schema has changed a bit.
The documented behavior can be found here:
<http://msdn2.microsoft.com/en-us/library/ms649781.aspx>
Pay special attention to the following note:
Important If you write an application for the 64 bit Windows platform, you
must change the processorArchitecture entry to
processorArchitecture="amd64". You can also specify "*", which ensures that
all platforms are targeted.
Note that * is actually the only value that works for managed applications
built with Target platform "Any CPU".
Any CPU (that is, MSIL ) means that the application can run on X86 or X64 or
IA64, however, the manifest needs a compatible processorArchitecture for the
common controls library (native code!!). processorArchitecture="X86" will
fail when running on X64, X64 will fail when you run on X86, so, the only
valid value in this case is "*".
Following are the valid combinations:
Target Platform processorArchitecture
X86 X86 or *
X64 X64 or *
Itanium IA64 or *
Any CPU *
Again, I would suggest you to file a bug to Connect.
Willy.
that is interesting, it could really be a difference in the schema which I
currently cannot try out so easily. I think I will file a bug in Connect
later regarding the whole thing.
But anyway, I think we covered a lot of possibilities here, so thank you
very much for all your information!
Best regards,
Stefanie