Добавил кликер на новую страничку
This commit is contained in:
parent
3a5fdb7dab
commit
639f66993e
@ -5,12 +5,15 @@
|
|||||||
Title="NewPage1">
|
Title="NewPage1">
|
||||||
<VerticalStackLayout>
|
<VerticalStackLayout>
|
||||||
<Label
|
<Label
|
||||||
Text="Welcome to .NET MAUI!"
|
|
||||||
VerticalOptions="Center"
|
|
||||||
HorizontalOptions="Center" />
|
|
||||||
<Label
|
|
||||||
Text="Новая страничка"
|
Text="Новая страничка"
|
||||||
|
FontSize="30"
|
||||||
VerticalOptions="Center"
|
VerticalOptions="Center"
|
||||||
HorizontalOptions="Center" />
|
HorizontalOptions="Center" />
|
||||||
|
<Button
|
||||||
|
x:Name="CounterBtn"
|
||||||
|
Text="Click me"
|
||||||
|
SemanticProperties.Hint="Counts the number of times you click"
|
||||||
|
Clicked="OnCounterClicked"
|
||||||
|
HorizontalOptions="Fill" />
|
||||||
</VerticalStackLayout>
|
</VerticalStackLayout>
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -2,8 +2,20 @@ namespace MobailApp;
|
|||||||
|
|
||||||
public partial class NewPage1 : ContentPage
|
public partial class NewPage1 : ContentPage
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
public NewPage1()
|
public NewPage1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user