Initializecomponent does not exist in the current context

Asked

Viewed 1,291 times

2

I have this code, where I have the error

[XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class AprovarPopup : PopupPage
    {
        public AprovarPopup()
        {
            InitializeComponent();
        }

        protected override void OnAppearing()
        {
            base.OnAppearing();
        }

        protected override void OnDisappearing()
        {
            base.OnDisappearing();
        }

        // Method for animation child in PopupPage
        // Invoced after custom animation end
        protected override Task OnAppearingAnimationEnd()
        {
            return Content.FadeTo(0.5);
        }

        // Method for animation child in PopupPage
        // Invoked before custom animation begin
        protected override Task OnDisappearingAnimationBegin()
        {
            return Content.FadeTo(1);
        }

        protected override bool OnBackButtonPressed()
        {
            // Prevent hide popup
            //return base.OnBackButtonPressed();
            return true;
        }

        // Invoced when background is clicked
        protected override bool OnBackgroundClicked()
        {
            // Return default value - CloseWhenBackgroundIsClicked
            return base.OnBackgroundClicked();
        }
    }

and this is my shampoo

<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
             xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
             x:Class="Demo.Pages.AprovarPopup">
    <!--Animations use example-->
    <pages:PopupPage.Animation>
        <animations:ScaleAnimation 
      PositionIn="Center"
      PositionOut="Center"
      ScaleIn="1.2"
      ScaleOut="0.8"
      DurationIn="400"
      DurationOut="300"
      EasingIn="SinOut"
      EasingOut="SinIn"
      HasBackgroundAnimation="True"/>
    </pages:PopupPage.Animation>
    <!-- Content -->
</pages:PopupPage>

in that link there is the likely answer, but did not understand the question of "Build Action" and also whether my x:Class that is correct.

EDIT1

I changed the "build action" both of shaman how much of xaml.Cs and switched to Page, error of Initializalizecomponent, but fired that:

The 'Page' build action has no combination support specific to the destinations of project. Authorizer C: Labs Authorizing Authorizing Authorizing Approving popup.xaml 0

EDIT2

I solved with a Clean and Recompile. I have observed in these few months with the tool Xamarin.Forms I solved a lot with Clean and Recompile. I saw that cleaning is almost everything, eheheh. The problem is already solved. I’ll leave like this, I promised that when I did a post and soon after the solution, I would not respond, not to think that I am trying to "cheat". Stays as Edition.

1 answer

0

Close the visual studio and emulator, go to C: Users SEU_USUARIO Appdata Local and remove the Xamarin folder, open the visual studio again and your app will compile normally

Browser other questions tagged

You are not signed in. Login or sign up in order to post.