App.xaml in class library

后端 未结 1 1312
梦如初夏
梦如初夏 2021-01-06 14:47

I have created a windows phone 7 custom class library, in that I have created App.xaml and App.xaml.cs files also(I have renamed them as MiEngineApp.xaml, MiEngineApp.xaml.c

相关标签:
1条回答
  • 2021-01-06 15:28

    You also have to change the App.xaml file. So this will be your MiEngine.xaml

    <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                 x:Class="MiEngine.MiEngineApp"
                 >
        <Application.Resources>
    
        </Application.Resources>
    </Application>
    

    and MiEngine.xaml.cs:

    namespace MiEngine
    {
        public partial class MiEngineApp : Application
        {
    
            public MiEngineApp()
            {
    

    This will be the App.xaml that inherits from (extends) MiEngine.xaml:

    <z:MiEngineApp xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                 x:Class="SilverlightApplication6.App"
    
                 xmlns:z="clr-namespace:MiEngine;assembly=MiEngine"
                 >
        <z:MiEngineApp.Resources>
    
        </z:MiEngineApp.Resources>
    </z:MiEngineApp>
    

    Note the use of the z namespace so that i can reference the base class.
    And the codebehind for that:

    namespace SilverlightApplication6
    {
        public partial class App : MiEngineApp
        {
    
            public App()
            {
    
    0 讨论(0)
提交回复
热议问题