Windows 10 Universal - 将多个代码隐藏文件添加到 mainPage
Windows 10 Universal - Add multiple code behind files to mainPage
我可能没有正确解释这一点,但我一直在查看 Microsoft 的 ManualCameraControls 示例应用程序。在 MainPage.xaml 下的那个应用程序中,他们似乎有多个代码隐藏文件(即 MainPage.zoom.xaml.cs)。
我是 Windows 10 Universal 的新手,谁能告诉我这是怎么做到的?
术语"code behind"仅描述了人类的概念。 .xaml 和 .xaml.cs 只属于彼此,因为它们包含编译成一个 class 的部分 classes。 .xaml.cs 文件在 Visual Studio 中显示为它们的 .xaml 文件的子文件,因为 .csproj 中有 DependentUpon
标记。一些例子:
<ItemGroup>
<Compile Include="SomeClass.xaml.cs">
<DependentUpon>SomeClass.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="SomeClass.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
在那个例子中也是这样实现的。
我可能没有正确解释这一点,但我一直在查看 Microsoft 的 ManualCameraControls 示例应用程序。在 MainPage.xaml 下的那个应用程序中,他们似乎有多个代码隐藏文件(即 MainPage.zoom.xaml.cs)。
我是 Windows 10 Universal 的新手,谁能告诉我这是怎么做到的?
术语"code behind"仅描述了人类的概念。 .xaml 和 .xaml.cs 只属于彼此,因为它们包含编译成一个 class 的部分 classes。 .xaml.cs 文件在 Visual Studio 中显示为它们的 .xaml 文件的子文件,因为 .csproj 中有 DependentUpon
标记。一些例子:
<ItemGroup>
<Compile Include="SomeClass.xaml.cs">
<DependentUpon>SomeClass.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="SomeClass.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
在那个例子中也是这样实现的。