Xaml Xamarin:具有键';X';已存在于命名空间中

Xaml Xamarin:具有键';X';已存在于命名空间中,xaml,xamarin.forms,Xaml,Xamarin.forms,当我尝试推到新页面时,出现以下错误 (我使用的是Xamarin.表格4.6.0.800) 任何帮助都将不胜感激。 Mike在我的代码中,我有初始化组件()声明两次。当系统尝试用相同的名称初始化相同的组件时,通常会发生这种类型的问题。请检查初始化组件()可能,它声明了两次。您是否在代码隐藏中声明了一个名称冲突的变量?#Jason,不,我不这么认为,我已将代码隐藏添加到question@Jason,如我在问题中所述,如果我删除冲突元素,它只会进入XAML中的下一个名称。您可以按照下面的bugs@Ka

当我尝试推到新页面时,出现以下错误

(我使用的是Xamarin.表格4.6.0.800)

任何帮助都将不胜感激。
Mike

在我的代码中,我有初始化组件()声明两次。

当系统尝试用相同的名称初始化相同的组件时,通常会发生这种类型的问题。请检查
初始化组件()可能,它声明了两次。

您是否在代码隐藏中声明了一个名称冲突的变量?#Jason,不,我不这么认为,我已将代码隐藏添加到question@Jason,如我在问题中所述,如果我删除冲突元素,它只会进入XAML中的下一个名称。您可以按照下面的bugs@Karan Rami检查它,它不会帮助我解决我的问题。您可以稍后标记此答案,这将帮助更多有相同问题的人:)。
{System.ArgumentException: An element with the key 'NewAccountLogo' already exists in NameScope
Parameter name: name
  at Xamarin.Forms.Internals.NameScope.Xamarin.Forms.Internals.INameScope.RegisterName (System.String name, System.Object scopedElement) [0x0000e] in D:\a\1\s\Xamarin.Forms.Core\Internals\NameScope.cs:21 
  at amici.NewAccount.InitializeComponent () [0x00078] in C:\Users\X\source\repos\amici\amici\amici\obj\Debug\netstandard2.0\NewAccount.xaml.g.cs:46 
  at amici.NewAccount..ctor () [0x0000f] in C:\Users\X\source\repos\amici\amici\amici\NewAccount.xaml.cs:26 
  at amici.Logon+<OnCreateAccountClick>d__3.MoveNext () [0x0002a] in C:\Users\X\source\repos\amici\amici\amici\logon.xaml.cs:119 }
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             NavigationPage.HasNavigationBar="True"
             Title="New Account"
             x:Class="amici.NewAccount">
    <ContentPage.Content >
        <ScrollView>
            <Grid>
                <StackLayout Margin="20" Padding="10" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1">
                    <Image x:Name="NewAccountLogo"/>
                    <Entry x:Name="NewEmail" Placeholder="Email"/>
                    <Entry x:Name="EmailConfirm" Placeholder="Confirm Email"/>

                    <Label Text="Password between 6 and 20 characters; must contain at least one lowercase letter, one uppercase letter, one numeric digit." Margin="0,0,0,5"></Label>


                    <Entry x:Name="NewPassword" IsPassword="true" Placeholder="Password"/>
                    <Entry x:Name="PasswordConfirm" IsPassword="true" Placeholder="Confirm Password"/>

                    <Label x:Name="bntCreatAccountButton" TextColor="Blue" Text="Create Account" HorizontalOptions="Center" Margin="0,25,0,0">
                        <Label.GestureRecognizers>
                            <TapGestureRecognizer Tapped="OnCreateAccount" NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>
                </StackLayout>
                <ActivityIndicator x:Name="WaitIcon"  IsRunning="{Binding IsBusy}" VerticalOptions="Center" HorizontalOptions="Center" />
            </Grid>
        </ScrollView>
    </ContentPage.Content>
</ContentPage>
  [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class NewAccount : ContentPage
    {
        public NewAccount()
        {
            InitializeComponent ();

            this.InitializeComponent();
            this.BindingContext = this;
            this.IsBusy = false;

            var bkgrndGradient = new Gradient()
            {
                Rotation = 150,
                Steps = new GradientStepCollection()
                {
                    new GradientStep(Color.White, 0),
                    new GradientStep(Color.White, .5),
                    new GradientStep(Color.FromHex("#ccd9ff"), 1)
                }
            };

            ContentPageGloss.SetBackgroundGradient(this, bkgrndGradient);
            NewAccountLogo.Source = ImageSource.FromFile("logo.png");
        }



        async private void OnCreateAccount(object sender, EventArgs e)
        {

            string Message = string.Empty;
            string title = string.Empty;
            bool results = false;
            IsBusy = true;

            try
            {


                if (ComparisonBehavior.CompareValues(NewEmail.Text, NewPassword.Text, EmailConfirm.Text,PasswordConfirm.Text, ref Message, ref title))
                {

                    await Task.Delay(1000);
                    results = RestController.CreateAccount(NewEmail.Text, NewPassword.Text);
                    IsBusy = false;

                    if (results)
                    {
                        await DisplayAlert("New Account Created.", "Thank You! Please check your email (junk mail) to activate your subscription.", "OK");
                        await Application.Current.MainPage.Navigation.PopAsync();

                    }else
                    {
                        if (Application.Current.Properties["resp"].ToString() == "Account exist")
                        {
                            await DisplayAlert("Account Exist", "Sorry this email already exist!", "OK");
                        }

                    }
                }else
                {
                    await DisplayAlert(title, Message, "OK");
                }


            }catch (Exception ex)
            {
                 await DisplayAlert("internal Error", ex.Message, "OK");
            } finally{
                IsBusy = false;
           }

        }
    }