为什么不在XP上运行WPF App [英] Why don't run WPF App on XP
问题描述
大家好,
我在VS2010,.net framework 3.5,c#的wpf中创建了一个简单的窗口,然后将其运行到win7 x86,结果是 mainWindow [ XP专业版 [ err1 [ err2 [万岁! Quds Day [ ^ ]
Hi guys,
I create a simple window in wpf by VS2010, .net framework 3.5, c# and I run it to win7 x86 that result was mainWindow[^], but I try that''s it on XP 32bit by this properties XP pro[^]and result was crash app err1[^], err2[^], I also install .net framework packages, DirectX, windows installer and so on... but didn''t run!
Where is the problem? Is there a solution?
If was necessary more info about this issue, please tell me.
Thanks in advance
and Viva! Quds Day[^]
推荐答案
要对此进行更好的调试并获得正确的信息,请在app.xaml中添加一个事件处理程序,如下所示:例子
To debug this a little better and get proper information add an eventhandler to the app.xaml like in this example
<application x:class="interMASTER.App" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:InterstoneViewModel;assembly=InterstoneViewModel"
StartupUri="MainWindow.xaml" DispatcherUnhandledException="Application_DispatcherUnhandledException">
<application.resources>
<!-- Resources scoped at the Application level should be defined here. -->
</application.resources>
</application>
然后在部分类App.xaml.cs中执行以下操作:
Then in the partial class App.xaml.cs do this :
public partial class App : Application
{
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show(e.Exception.Message+" "+e.Exception.StackTrace);
}
}
这样,当出现问题时,会出现一个不错的对话框,并将信息发布到那些讨厌的位图上.
This way a nice dialog will appear when something is wrong and post that informaton iso those nasty bitmaps.
这篇关于为什么不在XP上运行WPF App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!