Can I use 2 App.XAML in one silverlight project?
Can I use 2 App.XAML in one silverlight project?
If answer is 开发者_JS百科Yes. How can I select from that use in Application use? If No. Can you explain the reason?
To naively answer the question you've appear to have asked; the answer is no you can't. Ultimately the application manifest must specify a single assembly and type that is derives from Application
.
However here is my guess at what you really want to achieve. You don't want to have to define all the application resources in a single App.xaml file.
You can divide up resources into separate resource dictionary files. Use the "Add New Item..." on the project and select the "Silverlight Resource Dictionary". Create two or more of these and divide up the resources currently in App.xaml into these new files in a logical fashion. For sake of example lets say you have a "Colors.xaml" and a "CommonStyles.xaml".
Now you use the MergedDictionaries
property to list these resource dictionaries to aggregate them into your App.Xaml. Ideally your App.xaml just ends up looking like this:-
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Colors.xaml" />
<ResourceDictionary Source="CommonStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
You can have multiple Applications inside a Silverlight project, you just select the one you want inside the Project Property sheet under Startup object.
精彩评论