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