开发者

Windows Form launched from WPF window showing no current system theme. Why?

I have a WPF application that has a variable "x" which is an instance of a class from a custom C# assembly called "MyClasses.dll". This variable "x" has a method "LaunchForm" that launches a Windows Form "Form1" from another assembly "MyForms.dll". The form is launched as a dialog and shown in the screen but the current Windows XP / Win7 theme/skin is not applied to it. If this "Form1" is launched from a Windows Form (not WPF window) it is shown correctly though. Any ideas why this is happening? Any hints to solve this issue?

Cheers all! Edgar

I just looked at the code again and I'm not using reflection on this way of launching the winform. The code as requested is in WPF:

MyInterface x=new MyClass1(); x.LaunchForm();

The code in 开发者_如何学运维MyClasses.dll:

public class MyClass1() : MyInterface { public MyClass1() {} public void LaunchForm() { Form1 Form1Dialog=new Form1(); Form1Dialog.ShowDialog(); } }

This, as mentioned, launches the winform from WPF but no windows theme is applied to it.


Probably you don't have the proper manifest to tell Windows you are compatible with the new theme (WPF doesn't need it).

I wrote about it on my blog at http://www.nbdtech.com/Blog/archive/2008/06/16/The-Application-Manifest-Needed-for-XP-and-Vista-Style-File.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜