Add (Vu_hommePage): Starting on Navigation & ToolbarItem

pull/2/head
Louis DUFOUR 2 years ago committed by Louis DUFOUR
parent 4250fdf160
commit 68bb2a0fee

@ -6,14 +6,17 @@
xmlns:local="clr-namespace:BookApp" xmlns:local="clr-namespace:BookApp"
Shell.FlyoutBehavior="Disabled"> Shell.FlyoutBehavior="Disabled">
<TabBar> <TabBar>
<Tab Title="My Library" <Tab Title="My Library"
Icon="books_vertical_fill.svg"> Icon="books_vertical_fill.svg">
<ShellContent ContentTemplate="{DataTemplate local:MainPage}" /> <ShellContent ContentTemplate="{DataTemplate local:MainPage}"
Route="Mainpage"/>
</Tab> </Tab>
<Tab Title="My lists" <Tab Title="My lists"
Icon="dog.png"> Icon="dog.png">
<ShellContent ContentTemplate="{DataTemplate local:MainPage}" /> <ShellContent ContentTemplate="{DataTemplate local:Tous}"
Route="Tous"/>
</Tab> </Tab>
<Tab Title="My Readings" <Tab Title="My Readings"
Icon="dog.png"> Icon="dog.png">

@ -5,6 +5,7 @@
public AppShell() public AppShell()
{ {
InitializeComponent(); InitializeComponent();
Routing.RegisterRoute(nameof(Tous), typeof(Tous));
} }
} }
} }

@ -3,39 +3,31 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookApp.MainPage"> x:Class="BookApp.MainPage">
<ScrollView> <ContentPage.ToolbarItems>
<VerticalStackLayout <ToolbarItem Command="{Binding SetLowBrightnessCommand}">
Spacing="25" <ToolbarItem.IconImageSource>
Padding="30,0" <FontImageSource
VerticalOptions="Center"> FontFamily="MaterialIconsOutlined-Regular"
Glyph="&#xe51c;"/>
</ToolbarItem.IconImageSource>
</ToolbarItem>
</ContentPage.ToolbarItems>
<Image <Grid>
Source="dotnet_bot.png" <Label>Mes livres</Label>
SemanticProperties.Description="Cute dot net bot waving hi to you!" <StackLayout>
HeightRequest="200" <Button Text="Click to Rotate Text!"
HorizontalOptions="Center" /> VerticalOptions="Center"
HorizontalOptions="Center"
Clicked="OnButtonClicked" />
<Label x:Name="label"
Text="Click the Button above"
FontSize="18"
VerticalOptions="Center"
HorizontalOptions="Center" />
</StackLayout>
</Grid>
<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
<Label
Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ScrollView>
</ContentPage> </ContentPage>

@ -2,13 +2,19 @@
{ {
public partial class MainPage : ContentPage public partial class MainPage : ContentPage
{ {
int count = 0; //int count = 0;
public MainPage() public MainPage()
{ {
InitializeComponent(); InitializeComponent();
} }
async void OnButtonClicked(object sender, EventArgs args)
{
await Shell.Current.GoToAsync(nameof(Tous));
}
/*
private void OnCounterClicked(object sender, EventArgs e) private void OnCounterClicked(object sender, EventArgs e)
{ {
count++; count++;
@ -19,6 +25,6 @@
CounterBtn.Text = $"Clicked {count} times"; CounterBtn.Text = $"Clicked {count} times";
SemanticScreenReader.Announce(CounterBtn.Text); SemanticScreenReader.Announce(CounterBtn.Text);
} }*/
} }
} }

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookApp.Tous"
Title="Tous">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BookApp
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Tous : ContentPage
{
public Tous()
{
InitializeComponent();
}
}
}
Loading…
Cancel
Save