0
1つのコードから複数の部分クラスにコードを分割する必要がありますが、これをどのように達成できるかわからず、1つのmsdnコードサンプルで可能です私はこれをどのように達成できるか教えてください。同じxamlファイルの複数の部分クラスを作成する方法
私はMVVMに移行することができますが、今のところ、部分的なクラスでコードを整理する必要があります。
以下のスクリーンショットをご覧ください。
1つのコードから複数の部分クラスにコードを分割する必要がありますが、これをどのように達成できるかわからず、1つのmsdnコードサンプルで可能です私はこれをどのように達成できるか教えてください。同じxamlファイルの複数の部分クラスを作成する方法
私はMVVMに移行することができますが、今のところ、部分的なクラスでコードを整理する必要があります。
以下のスクリーンショットをご覧ください。
あなたが好きな命名規則に追加のファイルを作成し、それらに部分クラスを追加することによってそれを行うことができます。コードは以前と同じようにコンパイルされ、動作します。
MainPage.xaml.cs:
public partial class MainPage : Page {...}
MainPage.Flash.xaml.cs:
public partial class MainPage {...}
あなたが添付された画像に表示ものを手に入れるには、編集を手動で関与しますプロジェクトファイル。テキストエディタであなたのプロジェクトファイルを開き、それは背後にあるあなたの現在のコードのためにどのように行われるかを見て、プロセスは、ここで同じ
であることは、あなたが提供された画像は、プロジェクトファイルにどのように見えるかの例である
<ItemGroup>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="MainPage.ExposureValue.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.Flash.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.Focus.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.IsoSpeed.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.Shutter.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.WhiteBalance.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.Zoom.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
あなたは好きな命名規則で追加のファイルを作成し、それらに部分クラスを追加することでこれを行うことができます。コードは以前と同じようにコンパイルされ、動作します。添付された画像に表示する内容を取得するには、プロジェクトファイルを手動で編集する必要があります。テキストエディタでプロジェクトファイルを開き、現在のコードがどのように処理されているかを見て、プロセスは同じです – Nkosi