I have XAML file say SomePage.xaml.
I was making a mistake by refactored it's code behind class from SomePage to CardsPage class.
Now XAML file doesn't link with the code behind anymore.
How to link these files together again?
I have XAML file say SomePage.xaml.
I was making a mistake by refactored it's code behind class from SomePage to CardsPage class.
Now XAML file doesn't link with the code behind anymore.
How to link these files together again?
I have some problems when I refactor the code behind with the XAML(renaming for example) and I find a small extension to "relink" files together.
https://marketplace.visualstudio.com/items?itemName=MadsKristensen.FileNesting
It's easier than modifying the csproj and less dangerous.
See Example Below
Step 2
[![[2]](https://i.stack.imgur.com/cORDH.png)
Result
If you are using Xamarin Forms, try editing your ".projitems" file located on the same directory of your .xaml files of your Xamarin project, there is the asociation between the .cs files and .xaml files like this
<Compile Include="$(MSBuildThisFileDirectory)MyPage.xaml.cs">
<DependentUpon>MyPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)MyPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<Compile Update="C:\Projects\MyPage.xaml.cs">
<DependentUpon>MyPage.xaml</DependentUpon>
</Compile>