In this example we are going to see Stepper Example in MAUI.
1) Add new page and Update code as below.
<?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="MauiApp1.StepperEXP1"
Title="StepperEXP1">
<VerticalStackLayout>
<Stepper x:Name="StepperName" Maximum="20" Minimum="2" Increment="2"
ValueChanged="StepperName_ValueChanged"></Stepper>
<Label x:Name="lblData"></Label>
</VerticalStackLayout>
</ContentPage>
2) Go to .CS page and update as below.
namespace MauiApp1;
public partial class StepperEXP1 : ContentPage
{
public StepperEXP1()
{
InitializeComponent();
}
private void StepperName_ValueChanged(object sender, ValueChangedEventArgs e)
{
if(StepperName!=null)
{
lblData.Text = StepperName.Value.ToString();
}
}
}
Output:
Code in Github: https://github.com/adi501/MAUI
No comments:
Post a Comment