converting WPF project to Silverlight. Somehow the application crashes
Im trying to convert my WPF project to Silverlight. The WPF project was written in MVVM template. it doesnt connect to any database, ive used an XML serializer to create and read from XML file.
But somehow the application crashes. I think it maybe the App.Xaml. But I am unable to debug the silverlight application, as it gives an error "The breakpoint will开发者_JAVA技巧 not currently be hit., no symbols have been loaded for this document"....
Not too sure where to go from here...
private void Application_Startup(object sender, StartupEventArgs e)
{
Views.MainPage view = new Views.MainPage();
ViewModels.MainPageViewModel mainViewModel = new ViewModels.MainPageViewModel();
mainViewModel.LoadProducts("Products.xml");
view.DataContext = mainViewModel;
this.RootVisual = view;
}
I'm not sure whether this is the problem or not, but you mentioned that your WPF application read from an XML file. Where is this XML file located? Silverlight is going to have some limitations on what it can access if it is being run in-browser, and may not be able to read the file if the LoadProducts
method tries to read it from disk.
The App.xaml is loaded before your user-code executes, so that may be the problem with the breakpoint. Can't you attach to the process to see what the exception is?
精彩评论