Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public override string ToString()
new GalleryPageFactory(() => new ScrollViewCoreGalleryPage(), "ScrollView Gallery"),
new GalleryPageFactory(() => new SearchBarCoreGalleryPage(), "Search Bar Gallery"),
new GalleryPageFactory(() => new SliderCoreGalleryPage(), "Slider Gallery"),
new GalleryPageFactory(() => new StepperControlPage(), "Stepper Feature Matrix"),
new GalleryPageFactory(() => new StepperCoreGalleryPage(), "Stepper Gallery"),
new GalleryPageFactory(() => new SwitchCoreGalleryPage(), "Switch Gallery"),
new GalleryPageFactory(() => new SwipeViewCoreGalleryPage(), "SwipeView Gallery"),
Expand All @@ -79,7 +80,6 @@ public override string ToString()
new GalleryPageFactory(() => new SliderControlPage(), "Slider Feature Matrix"),
new GalleryPageFactory(() => new CollectionViewFeaturePage(), "CollectionView Feature Matrix"),
new GalleryPageFactory(() => new CarouselViewFeaturePage(), "CarouselView Feature Matrix"),

};

public CorePageView(Page rootPage)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?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"
xmlns:local="clr-namespace:Maui.Controls.Sample"
x:Class="Maui.Controls.Sample.StepperControlMainPage"
x:DataType="local:StepperViewModel"
Title="StepperFeature">

<ContentPage.ToolbarItems>
<ToolbarItem Text="Options"
Clicked="NavigateToOptionsPage_Clicked"
AutomationId="Options"/>
</ContentPage.ToolbarItems>

<Grid Padding="20"
RowDefinitions="*, Auto, Auto, Auto"
ColumnDefinitions="*,*"
RowSpacing="10"
ColumnSpacing="10"
HorizontalOptions="Center"
VerticalOptions="Center">

<!-- Stepper Control -->
<Stepper Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Minimum="{Binding Minimum}"
Maximum="{Binding Maximum}"
Increment="{Binding Increment}"
Value="{Binding Value}"
IsEnabled="{Binding IsEnabled}"
IsVisible="{Binding IsVisible}"
FlowDirection="{Binding FlowDirection}"
AutomationId="StepperControl"/>

<!-- Minimum Value -->
<Label Grid.Row="1"
Grid.Column="0"
Text="Minimum:"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"/>
<Label Grid.Row="1"
Grid.Column="1"
AutomationId="MinimumLabel"
Text="{Binding Minimum, StringFormat='{0:F2}'}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="End"/>


<!-- Maximum Value -->
<Label Grid.Row="2"
Grid.Column="0"
Text="Maximum:"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"/>
<Label Grid.Row="2"
Grid.Column="1"
AutomationId="MaximumLabel"
Text="{Binding Maximum, StringFormat='{0:F2}'}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="End"/>

<!-- Current Value -->
<Label Grid.Row="3"
Grid.Column="0"
Text="Value:"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"/>
<Label Grid.Row="3"
Grid.Column="1"
AutomationId="ValueLabel"
Text="{Binding Value, StringFormat='{0:F2}'}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="End"/>
</Grid>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

public class StepperControlPage : NavigationPage
{

public StepperControlPage()
{
PushAsync(new StepperControlMainPage());
}
}
public partial class StepperControlMainPage : ContentPage
{
private StepperViewModel _viewModel;

public StepperControlMainPage()
{
InitializeComponent();
BindingContext = _viewModel = new StepperViewModel();
}

private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e)
{
BindingContext = _viewModel = new StepperViewModel();
await Navigation.PushAsync(new StepperFeaturePage(_viewModel));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?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"
xmlns:local="clr-namespace:Maui.Controls.Sample"
x:Class="Maui.Controls.Sample.StepperFeaturePage"
Title="StepperFeature">

<ContentPage.ToolbarItems>
<ToolbarItem Text="Apply"
Clicked="ApplyButton_Clicked"
AutomationId="Apply"/>
</ContentPage.ToolbarItems>

<Grid Padding="10"
ColumnDefinitions="Auto, *"
RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto"
RowSpacing="10"
ColumnSpacing="15">
<!-- Minimum Value -->
<Label Grid.Row="0"
Grid.Column="0"
Text="Minimum:"
FontSize="15"
VerticalTextAlignment="Center"/>
<Entry Grid.Row="0"
Grid.Column="1"
x:Name="MinimumEntry"
AutomationId="MinimumEntry"
TextChanged="OnMinimumChanged"
Keyboard="Numeric"
HorizontalOptions="Start"
WidthRequest="100"/>

<!-- Maximum Value -->
<Label Grid.Row="1"
Grid.Column="0"
Text="Maximum:"
FontSize="15"
VerticalTextAlignment="Center"/>
<Entry Grid.Row="1"
Grid.Column="1"
x:Name="MaximumEntry"
AutomationId="MaximumEntry"
TextChanged="OnMaximumChanged"
Keyboard="Numeric"
HorizontalOptions="Start"
WidthRequest="100"/>

<!-- Increment -->
<Label Grid.Row="2"
Grid.Column="0"
Text="Increment:"
FontSize="15"
VerticalTextAlignment="Center"/>
<Entry Grid.Row="2"
Grid.Column="1"
x:Name="IncrementEntry"
AutomationId="IncrementEntry"
TextChanged="OnIncrementChanged"
Keyboard="Numeric"
HorizontalOptions="Start"
WidthRequest="100"/>

<!-- Current Value -->
<Label Grid.Row="3"
Grid.Column="0"
Text="Value:"
FontSize="15"
VerticalTextAlignment="Center"/>
<Entry Grid.Row="3"
Grid.Column="1"
x:Name="ValueEntry"
AutomationId="ValueEntry"
TextChanged="OnValueChanged"
Keyboard="Numeric"
HorizontalOptions="Start"
WidthRequest="100"/>

<!-- Is Enabled -->
<Label Grid.Row="4"
Grid.Column="0"
Text="Is Enabled:"
FontSize="15"
VerticalTextAlignment="Center"/>
<StackLayout Grid.Row="4"
Grid.Column="1"
Orientation="Horizontal"
Spacing="10">
<RadioButton x:Name="IsEnabledTrueRadio"
AutomationId="IsEnabledTrueRadio"
GroupName="IsEnabled"
Content="True"
IsChecked="True"
FontSize="14"
CheckedChanged="OnIsEnabledCheckedChanged"/>
<RadioButton x:Name="IsEnabledFalseRadio"
AutomationId="IsEnabledFalseRadio"
GroupName="IsEnabled"
Content="False"
FontSize="14"
CheckedChanged="OnIsEnabledCheckedChanged"/>
</StackLayout>

<!-- Is Visible -->
<Label Grid.Row="5"
Grid.Column="0"
Text="Is Visible:"
FontSize="15"
VerticalTextAlignment="Center"/>
<StackLayout Grid.Row="5"
Grid.Column="1"
Orientation="Horizontal"
Spacing="10">
<RadioButton x:Name="IsVisibleTrueRadio"
AutomationId="IsVisibleTrueRadio"
GroupName="IsVisible"
Content="True"
IsChecked="True"
FontSize="14"
CheckedChanged="OnIsVisibleCheckedChanged"/>
<RadioButton x:Name="IsVisibleFalseRadio"
AutomationId="IsVisibleFalseRadio"
GroupName="IsVisible"
Content="False"
FontSize="14"
CheckedChanged="OnIsVisibleCheckedChanged"/>
</StackLayout>

<!-- Flow Direction -->
<Label Grid.Row="8"
Grid.Column="0"
Text="Flow Direction:"
FontSize="15"
VerticalTextAlignment="Center"/>
<StackLayout Grid.Row="8"
Grid.Column="1"
Orientation="Horizontal"
Spacing="10">
<RadioButton x:Name="FlowDirectionLTRRadio"
AutomationId="FlowDirectionLTRRadio"
GroupName="FlowDirection"
Content="LeftToRight"
IsChecked="True"
FontSize="14"
CheckedChanged="OnFlowDirectionChanged"/>
<RadioButton x:Name="FlowDirectionRTLRadio"
AutomationId="FlowDirectionRTLRadio"
GroupName="FlowDirection"
Content="RightToLeft"
FontSize="14"
CheckedChanged="OnFlowDirectionChanged"/>
</StackLayout>
</Grid>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

public partial class StepperFeaturePage : ContentPage
{
private StepperViewModel _viewModel;

public StepperFeaturePage(StepperViewModel viewModel)
{
InitializeComponent();
_viewModel = viewModel;
BindingContext = _viewModel;
}

private void ApplyButton_Clicked(object sender, EventArgs e)
{
Navigation.PopAsync();
}

private void OnMinimumChanged(object sender, TextChangedEventArgs e)
{
if (double.TryParse(MinimumEntry.Text, out double min))
{
_viewModel.Minimum = min;
}
}

private void OnMaximumChanged(object sender, TextChangedEventArgs e)
{
if (double.TryParse(MaximumEntry.Text, out double max))
{
_viewModel.Maximum = max;
}
}

private void OnIncrementChanged(object sender, TextChangedEventArgs e)
{
if (double.TryParse(IncrementEntry.Text, out double increment))
{
_viewModel.Increment = increment;
}
}

private void OnValueChanged(object sender, TextChangedEventArgs e)
{
if (double.TryParse(ValueEntry.Text, out double value))
{
_viewModel.Value = value;
}
}

private void OnIsEnabledCheckedChanged(object sender, CheckedChangedEventArgs e)
{
_viewModel.IsEnabled = IsEnabledTrueRadio.IsChecked;
}

private void OnIsVisibleCheckedChanged(object sender, CheckedChangedEventArgs e)
{
_viewModel.IsVisible = IsVisibleTrueRadio.IsChecked;
}

private void OnFlowDirectionChanged(object sender, CheckedChangedEventArgs e)
{
_viewModel.FlowDirection = FlowDirectionLTRRadio.IsChecked ? FlowDirection.LeftToRight : FlowDirection.RightToLeft;
}
}
Loading
Loading