Issue with 'InitializeComponent' method...!

VaibhavMVaibhavM USMember ✭✭

Hi all,
I am working with the PCL project and recently I have upgraded the Xamarin Forms to version 2.0. Now I am getting the problem with 'InitializeComponent' method.
It shows the error : "The name 'InitializeComponent' does not exist in the current context".

Does anyone know solution for this ?

Posts

  • VaibhavMVaibhavM USMember ✭✭

    Is there anyone who will help me ? I am still stuck on this issue :(

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭

    Are you using XAML?

    Please show some XAML and/or code.

    This is usually the case when your XAML page and code-behind class don't match.

    Note that your root XAML node has to have a attribute like this x:Class="App.Namespace.Classname" and the according class like public partial class Classname

  • VaibhavMVaibhavM USMember ✭✭

    Thanx Gerald for your reply.

    Here is some code.
    x:Class ="MyProject.Views.LoginView"
    and .cs code is
    namespace MyProject.Views
    {
    public partial class LoginView : ContentPage
    {

    I think all is good though its giving problem

    any other possibilities ?

  • JulienRosenJulienRosen CAMember ✭✭✭✭

    make a new xaml page, and compare it against your broken one. usually this error is because the xaml and code behind file are out of sync re: namespace or classnames

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭

    Is your XAML page a ContentPage as well?

  • VaibhavMVaibhavM USMember ✭✭
    edited January 2016

    Ohh its shocking :open_mouth:

    As I have added a new XAML page in my project, my issue get resolved.

    Thanx Gerald and Julien for support.

    This discussion can be closed now.

Sign In or Register to comment.