Friday, August 5, 2016

Xamarin.Forms InitializeContext Does Not Exists In The Current Context Error Due to Title Property in ContentPage tag


I am new to Xamarin.. As a first app with Xamarin I started to develop an cross-platform mobile application to one of my friends project.
After creating a new Xamarin Forms project in Visual Studio and started to add new pages by looking at examples in Xamarin developer website.

But, after some time, I started to receive an issue in my Visual Studio project. The error was, it starts to give "The name 'initializeContext' does not exists in the current context" error.. it comes suddenly and stays..

I tried clean and rebuild the VS project. Also, remove Xamarin.Forms NuGet package folder and restored it. But, anything didn't solve my issue.


But, After looking into xaml pages I remember that I added "Title" property to "ContentPage" nodes..

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             x:Class="MyFirst.Mobile.App.Pages.HomePage"             Title="Home">

I just tried to remove that property and that is.. Everything started to work again...


Even thought I can see this "Title" property in Xamarin Developer website examples, it sometimes started to return some unexpected results...


So, I hope if this helps someone who faces this same issue in future...

Happy Xamaring... :-)

No comments:

Post a Comment