Friday, September 15, 2017

How to fix XAML codebehind separated when import to the Visual Studio

    The little thing that bothering me when importing an existing XAML file with code behind class to the Visual Studio / Xamarin Studio is the file will be separated with the code behind. of course it will made the project cannot be compiled because of the InitializeComponent() cannot execute in the code behind class. I didn't know why VS/XS not knowing the file as a one entity. so how to fix it, you just need to do some of simple step.

First one is you have to make a new class with the same name as the imported class name, and then select add existing file”. here the step with the screenshots.


Step 1 Add your XAML file and code behind class

as you can see that the file that you are import is separated became two, XAML file and .CS file.
Step 2 Make a new file with the same name




Step 3 Select “add existing file” twice for XAML file also for codebehind
Congratulation you have successfully fix it. simple right?

No comments:

Post a Comment

Contact me

Name

Email *

Message *