Silverlight: how to not load MergedDictionaries from app.xaml at startup?
As a workaround for the way Silverlight loads resources, I implemented the solution posted here: Silverlight Shared MergedDictionaries
This works fine, but it's annoying having to comment out the resource dictionaries in the app.xaml. I need to comment them to run the app, but uncommenting them lets me get a design view.
开发者_StackOverflowI am sure there's a way to get the app to not load these, but I'm not much of a dev. Can somebody point me to a tutorial or example? Some googling hasn't turned up anything. Thanks!
I found a simple answer: comment out InitializeComponent in App().
Looking at the code in App.g.i.cs:
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/SLPortalResources;component/App.xaml", System.UriKind.Relative));
}
Since this just loads what's in app.xaml, commenting it out works: the app runs and you get a design view.
Is there anything wrong with doing this?
精彩评论