Add (Vu_hommePage): Starting on Navigation & ToolbarItem

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

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

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

@ -3,39 +3,31 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookApp.MainPage">
<ScrollView>
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">
<ContentPage.ToolbarItems>
<ToolbarItem Command="{Binding SetLowBrightnessCommand}">
<ToolbarItem.IconImageSource>
<FontImageSource
FontFamily="MaterialIconsOutlined-Regular"
Glyph="&#xe51c;"/>
</ToolbarItem.IconImageSource>
</ToolbarItem>
</ContentPage.ToolbarItems>
<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />
<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>
<Grid>
<Label>Mes livres</Label>
<StackLayout>
<Button Text="Click to Rotate Text!"
VerticalOptions="Center"
HorizontalOptions="Center"
Clicked="OnButtonClicked" />
<Label x:Name="label"
Text="Click the Button above"
FontSize="18"
VerticalOptions="Center"
HorizontalOptions="Center" />
</StackLayout>
</Grid>
</ContentPage>

@ -2,23 +2,29 @@
{
public partial class MainPage : ContentPage
{
int count = 0;
//int count = 0;
public MainPage()
{
InitializeComponent();
}
private void OnCounterClicked(object sender, EventArgs e)
{
count++;
if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";
SemanticScreenReader.Announce(CounterBtn.Text);
}
async void OnButtonClicked(object sender, EventArgs args)
{
await Shell.Current.GoToAsync(nameof(Tous));
}
/*
private void OnCounterClicked(object sender, EventArgs e)
{
count++;
if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";
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