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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ -87,6 +87,7 @@ public override string ToString()
new GalleryPageFactory(() => new SwitchControlPage(), "Switch Feature Matrix"),
new GalleryPageFactory(() => new SwitchCoreGalleryPage(), "Switch Gallery"),
new GalleryPageFactory(() => new SwipeViewCoreGalleryPage(), "SwipeView Gallery"),
new GalleryPageFactory(() => new TabbedPageControlPage(), "TabbedPage Feature Matrix"),
new GalleryPageFactory(() => new TimePickerControlPage(), "Time Picker Feature Matrix"),
new GalleryPageFactory(() => new TimePickerCoreGalleryPage(), "Time Picker Gallery"),
new GalleryPageFactory(() => new WebViewCoreGalleryPage(), "WebView Gallery"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
xmlns:local="clr-namespace:Maui.Controls.Sample"
x:Class="Maui.Controls.Sample.TabbedPageControlMainPage"
x:DataType="local:TabbedPageViewModel"
android:TabbedPage.ToolbarPlacement="Top"
BarBackground="{Binding BarBackground}"
BarTextColor="{Binding BarTextColor}"
SelectedTabColor="{Binding SelectedTabColor}"
UnselectedTabColor="{Binding UnselectedTabColor}"
IsEnabled="{Binding IsEnabled}"
FlowDirection="{Binding FlowDirection}"
AutomationId="TabbedPageControl"
ItemsSource="{Binding ItemsSource}"
ItemTemplate="{Binding ItemTemplate}"
SelectedItem="{Binding SelectedItem}"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Maui.Controls.Sample;

public class TabbedPageControlPage : NavigationPage
{
private TabbedPageViewModel _viewModel;
public TabbedPageControlPage()
{
_viewModel = new TabbedPageViewModel();
PushAsync(new TabbedPageControlMainPage(_viewModel));
}
}
public partial class TabbedPageControlMainPage : TabbedPage
{
private TabbedPageViewModel _viewModel;

public TabbedPageControlMainPage(TabbedPageViewModel viewModel)
{
InitializeComponent();
_viewModel = viewModel;
BindingContext = _viewModel;
var button = new Button { AutomationId = "Options", Text = "Options" };
button.Clicked += NavigateToOptionsPage_Clicked;
NavigationPage.SetTitleView(this, button);
}

private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e)
{
BindingContext = _viewModel = new TabbedPageViewModel();
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new TabbedPageViewModel instance discards the current state and configuration. This should reuse the existing _viewModel instance to maintain test state consistency.

Suggested change
BindingContext = _viewModel = new TabbedPageViewModel();
BindingContext = _viewModel;

Copilot uses AI. Check for mistakes.
await Navigation.PushModalAsync(new TabbedPageOptionsPage(_viewModel));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
<?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.TabbedPageOptionsPage"
x:DataType="local:TabbedPageViewModel"
Title="TabbedPage Options">

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

<!-- BarBackground Brush -->
<Label Grid.Row="0"
Grid.Column="0"
Text="BarBackground Brush: "
FontSize="18"
FontAttributes="Bold"/>
<StackLayout Grid.Row="0"
Grid.Column="1"
Orientation="Horizontal"
Spacing="2">
<Button Text="Gradient"
Clicked="BarBackgroundBrushButton_Clicked"
BackgroundColor="Violet"
TextColor="White"
AutomationId="GradientBarBackgroundButton"/>
<Button Text="Solid"
Clicked="BarBackgroundBrushButton_Clicked"
BackgroundColor="Blue"
TextColor="White"
AutomationId="SolidBarBackgroundButton"/>
</StackLayout>

<!-- BarText Color -->
<Label Grid.Row="1"
Grid.Column="0"
Text="BarText Color: "
FontSize="18"
FontAttributes="Bold"/>
<StackLayout Grid.Row="1"
Grid.Column="1"
Orientation="Horizontal"
Spacing="2">
<Button Text="Black"
Clicked="BarTextColorButton_Clicked"
BackgroundColor="Black"
TextColor="White"
AutomationId="BlackBarTextButton"/>
<Button Text="Green"
Clicked="BarTextColorButton_Clicked"
BackgroundColor="Green"
TextColor="White"
AutomationId="GreenBarTextButton"/>
</StackLayout>

<!-- SelectedTab Color -->
<Label Grid.Row="2"
Grid.Column="0"
Text="SelectedTab Color: "
FontSize="18"
FontAttributes="Bold"/>
<StackLayout Grid.Row="2"
Grid.Column="1"
Orientation="Horizontal"
Spacing="2">
<Button Text="Orange"
Clicked="SelectedTabColorButton_Clicked"
BackgroundColor="Orange"
TextColor="Black"
AutomationId="OrangeSelectedButton"/>
<Button Text="Purple"
Clicked="SelectedTabColorButton_Clicked"
BackgroundColor="Purple"
TextColor="White"
AutomationId="PurpleSelectedButton"/>
</StackLayout>

<!-- UnselectedTab Color -->
<Label Grid.Row="3"
Grid.Column="0"
Text="UnselectedTab Color: "
FontSize="18"
FontAttributes="Bold"/>
<StackLayout Grid.Row="3"
Grid.Column="1"
Orientation="Horizontal"
Spacing="2">
<Button Text="LightGray"
Clicked="UnselectedTabColorButton_Clicked"
BackgroundColor="LightGray"
TextColor="Black"
AutomationId="LightGrayUnselectedButton"/>
<Button Text="DarkGray"
Clicked="UnselectedTabColorButton_Clicked"
BackgroundColor="DarkGray"
TextColor="White"
AutomationId="DarkGrayUnselectedButton"/>
</StackLayout>

<!-- Apply Button -->
<Label Grid.Row="4"
Grid.Column="0"
Text="Apply Button: "
FontSize="18"
FontAttributes="Bold"/>
<Button Grid.Row="4"
Grid.Column="1"
AutomationId="ApplyButton"
BackgroundColor="Blue"
Clicked="ApplyButton_Clicked"
HorizontalOptions="Start"
Text="Apply Changes"
TextColor="White"
WidthRequest="150"/>

<!-- IsEnabled -->
<Label Grid.Row="5"
Grid.Column="0"
Text="IsEnabled: "
FontSize="18"
FontAttributes="Bold"/>
<RadioButton Grid.Row="5"
Grid.Column="1"
Content="False"
CheckedChanged="OnIsEnabledChanged"
AutomationId="IsEnabledFalseRadio"/>

<!-- FlowDirection -->
<Label Grid.Row="6"
Grid.Column="0"
Text="FlowDirection: "
FontSize="18"
FontAttributes="Bold"/>
<StackLayout Grid.Row="6"
Grid.Column="1"
Orientation="Horizontal">
<RadioButton Content="LeftToRight"
CheckedChanged="OnFlowDirectionChanged"
AutomationId="LeftToRightFlowRadio"/>
<RadioButton Content="RightToLeft"
CheckedChanged="OnFlowDirectionChanged"
AutomationId="RightToLeftFlowRadio"/>
</StackLayout>

<!-- ItemsSource -->
<Label Grid.Row="7"
Grid.Column="0"
Text="ItemsSource: "
FontSize="18"
FontAttributes="Bold"/>
<StackLayout Grid.Row="7"
Grid.Column="1"
Orientation="Horizontal"
Spacing="2">
<Button Text="SourceOne"
Clicked="ItemsSourceOne_Clicked"
BackgroundColor="LightBlue"
AutomationId="ItemsSourceOneButton"/>
<Button Text="SourceTwo"
Clicked="ItemsSourceTwo_Clicked"
BackgroundColor="LightPink"
AutomationId="ItemsSourceTwoButton"/>
</StackLayout>

<!-- ItemTemplate -->
<Label Grid.Row="8"
Grid.Column="0"
Text="ItemTemplate: "
FontSize="18"
FontAttributes="Bold"/>
<StackLayout Grid.Row="8"
Grid.Column="1"
Orientation="Horizontal">
<Button AutomationId="TemplateOneButton"
Text="TemplateOne"
BackgroundColor="Teal"
TextColor="White"
Clicked="OnTemplateOneClicked"/>
<Button AutomationId="TemplateTwoButton"
Text="TemplateTwo"
BackgroundColor="Gold"
TextColor="Black"
Clicked="OnTemplateTwoClicked"/>
</StackLayout>

<!-- SelectedItem -->
<Label Grid.Row="9"
Grid.Column="0"
Text="SelectedItem: "
FontSize="18"
FontAttributes="Bold"/>
<StackLayout Grid.Row="9"
Grid.Column="1"
Orientation="Horizontal"
Spacing="2">
<Entry x:Name="selectedItemEntry"
AutomationId="SelectedItemEntry"
Text="1"
Keyboard="Numeric"
WidthRequest="80"/>
<Button Text="Select Tab"
Clicked="SelectItemButton_Clicked"
BackgroundColor="LightGreen"
AutomationId="SelectItemButton"/>
</StackLayout>
</Grid>
</ContentPage>
Loading
Loading