How can I connect xaml and xaml.cs files

前端 未结 11 1902
既然无缘
既然无缘 2020-12-14 05:27

I had a VB projected and converted it to C# using online conversion tools. Now the problem is xaml and xaml.cs file do not connect to each other, t

11条回答
  •  既然无缘
    2020-12-14 06:01

    An even easier and faster solution for Xamarin Forms projects, no need to touch csproj file at all, very quick fix.

    Make sure you have Show All Files selected for solution explorer - it may be on by default.

    1. Select all affected files
    2. Right click > Exclude from Project
    3. Select the same files again (should be faded out)
    4. Right Click > Include in Project

    They should now all be nested correctly and all the changes necessary to the .csproj file will be done.

    You may have an InitializeComponent() does not exist in the current context) error after this. If that's the case, the simple fix is..

    • Select all affected items and change Build Action from Page to Embedded Resource

提交回复
热议问题