I'm coming today because I'm stuck on an error. I just can't find the difference between the tutorial I'm following and my project.
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")]
private void InitializeComponent() {
this.LoadFromXaml(typeof(AppPageSwitcher));
Client = this.FindByName<global::Xamarin.Forms.Button>("Client");
}
Like mentioned in the tutorial, I've created a new Blank App (Xamarin.Forms Portable). Then, I've deleted the UWP part and the Win 8.1 as well. So I still have the reste (Portable/Android/iOS/WinPhone 8.1). It's also says to install and update several packages and everything is done for me.
So, they propose to create three class about their project, me I only created one which is related to TCP client connection. (TCPclient.cs)
PS: TCPclient.cs: I can't put the code because I'm trying to test it to make it works. That's why I need to create a graphic app.
Begin writing shared UI code
I'm at this step (I know, it's not far in the tutorial). They tell us to "Add a Forms Xaml Page named WeatherPage.cs by right-clicking the WeatherApp project and selecting Add > New Item....". I do it and create a first xaml page AppPageSwitcher.xaml. This page is just a test of desing from xaml.
<?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="PROJECT_NAME.Controlers.AppPageSwitcher">
<Button x:Name="Client" Content="Client"/>
</ContentPage>
So now, I made this code because I just want to try something easier
public partial class AppPageSwitcher : ContentPage
{
public AppPageSwitcher()
{
InitializeComponent();
this.Title = "PROJCET_NAME";
Client.Clicked += ClientButton_Clicked;
}
private void ClientButton_Clicked(object sender, EventArgs e)
{
Client.Text = this.Title;
}
}
And the issue appears:
this.LoadFromXaml(typeof(AppPageSwitcher));
I checked again and again, I tried to do the tutorial by creating the same project but without The weather key and... The button is present.. Where can be the difference? Moreover, I have a MaPage.xaml.cs that I've wrote like that:
<ContentPage.Content>
<local:CustomMap x:Name="customMap"/>
</ContentPage.Content>
I used <ContentPage.Content> unlike this tutorial and it worked. When I tried to add it, it didn't works.
It's so boring to get all of the time lot of errors like that.. Maybe it's easy to solves, but from hours, I'm stuck. If anyone can help, thank !