Hello, here is a snippet of the main class code, in it I basically set up and first "Page" with a menu in the footer (I just left a menu button to not get huge post)
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Boletim"
x:Class="Boletim.MainPage">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- PANEL 1 -->
<ContentView
Grid.Row="0"
IsVisible="True" BackgroundColor="White" x:Name="MainView">
</ContentView>
<Grid ColumnSpacing="0" RowSpacing="0" Grid.Row="1" BackgroundColor="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
// Aqui tem um menu inferior que pra eu mudar de pagina
<StackLayout Orientation="Vertical" HorizontalOptions="Center" Padding="20" Margin="-20,-10,-20,-17" Grid.Column="0">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="ClickTap2" NumberOfTapsRequired="1" />
</StackLayout.GestureRecognizers>
<Image x:Name="tab_home_icon" IsVisible="True" Source="ic_home_v.png" HeightRequest="22" WidthRequest="22" Margin="0,0,0,-2" />
<Label Margin="0" x:Name="tab_home" Text="HOME" FontSize="Micro" TextColor="Firebrick"/>
</StackLayout>
</Grid>
</Grid>
</ContentPage>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Boletim
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
var page = new Page1();
page.MostraDados();
MainView.Content = page.Content;
}
public void ClickTap2(object sender, EventArgs e)
{
var page = new Page3();
MainView.Content = page.Content;
//Icones
tab_home_icon.Source = "ic_home_v.png";
tab_calendar_icon.Source = "ic_calendar.png";
tab_map_icon.Source = "ic_map.png";
tab_info_icon.Source = "ic_info.png";
//label
tab_home.TextColor = Color.Firebrick;
tab_calendar.TextColor = Color.Black;
tab_map.TextColor = Color.Black;
tab_info.TextColor = Color.Black;
}
}
}
When it goes to Page3 it shows a listView and when I select an item it would have to go to another "page" but nothing happens.
<?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="Boletim.Page3">
<ContentPage.Content>
<ScrollView Orientation="Vertical">
<StackLayout>
<Image Source="http://via.placeholder.com/1800x250"/>
<SearchBar
TextChanged="SearchBar_TextChanged"
Placeholder="Busca..." >
</SearchBar>
<ListView
x:Name="lista_mp3"
HasUnevenRows="True"
IsPullToRefreshEnabled="True"
Refreshing="lista_mp3_Refreshing">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="45"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Column="0" Text="{Binding descricao}" FontSize="20" />
<Entry IsVisible="False" x:Name="arquivo" Grid.Column="1" Text="{Binding nome_arquivo}"/>
<Button Grid.Column="1" Image="ic_action_play_arrow" Clicked="Button_Clicked" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>
using Boletim.model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Boletim
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Page3 : ContentPage
{
public Page3()
{
InitializeComponent();
MostraDados();
}
private async void Button_Clicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new Page5());
}
}
}
Button_Clicked simply does not happen at all.
This navigation I'd like to work on. I think I would have to access ContentView from MainPage, but I tried to not get it.