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.
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 @@ -119,6 +119,7 @@ public override string ToString()
new GalleryPageFactory(() => new IndicatorViewControlPage(), "IndicatorView Feature Matrix"),
new GalleryPageFactory(() => new GridControlPage(), "Grid Feature Matrix"),
new GalleryPageFactory(() => new LayoutFeaturePage(), "ScrollView With LayoutOptions Feature Matrix"),
new GalleryPageFactory(() => new ShellFeaturePage(), "Shell Feature Matrix"),
};


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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.ShellFeatureMainPage"
Title="ShellFeatureMainPage">
<VerticalStackLayout Padding="20"
Spacing="10"
VerticalOptions="Center">
<Button Text="Shell Flyout"
Clicked="OnShellFlyoutButtonClicked"
HorizontalOptions="Center"
AutomationId="ShellFlyoutButton"
WidthRequest="400"/>
</VerticalStackLayout>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

public class ShellFeaturePage : NavigationPage
{
public ShellFeaturePage()
{
PushAsync(new ShellFeatureMainPage());
}
}

public partial class ShellFeatureMainPage : ContentPage
{
public ShellFeatureMainPage()
{
InitializeComponent();
}

private void OnShellFlyoutButtonClicked(object sender, EventArgs e)
{
Application.Current.MainPage = new ShellFlyoutControlPage();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell
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.ShellFlyoutControlPage"
x:DataType="local:ShellViewModel"
FlyoutWidth="{Binding FlyoutWidth}"
FlyoutHeight="{Binding FlyoutHeight}"
FlyoutIcon="{Binding FlyoutIcon}"
FlyoutIsPresented="{Binding FlyoutIsPresented}"
FlyoutBehavior="{Binding FlyoutBehavior, Mode=TwoWay}"
FlyoutHeader="{Binding FlyoutHeader, Mode=TwoWay}"
FlyoutFooter="{Binding FlyoutFooter, Mode=TwoWay}"
FlyoutHeaderTemplate="{Binding FlyoutHeaderTemplate, Mode=TwoWay}"
FlyoutFooterTemplate="{Binding FlyoutFooterTemplate, Mode=TwoWay}"
FlyoutContent="{Binding FlyoutContent, Mode=TwoWay}"
FlyoutContentTemplate="{Binding FlyoutContentTemplate, Mode=TwoWay}"
FlyoutBackgroundColor="{Binding FlyoutBackgroundColor, Mode=TwoWay}"
FlyoutBackgroundImage="{Binding FlyoutBackgroundImage, Mode=TwoWay}"
FlyoutBackgroundImageAspect="{Binding FlyoutBackgroundImageAspect, Mode=TwoWay}"
FlyoutHeaderBehavior="{Binding FlyoutHeaderBehavior, Mode=TwoWay}"
FlyoutBackdrop="{Binding FlyoutBackdrop}"
FlyoutVerticalScrollMode="{Binding FlyoutVerticalScrollMode}"
ItemTemplate="{Binding ItemTemplate, Mode=TwoWay}"
MenuItemTemplate="{Binding MenuItemTemplate,Mode=TwoWay}"
FlowDirection="{Binding FlowDirection}"
AutomationId="ShellFlyout">
<FlyoutItem
x:Name="HomeFlyoutItem"
Title="FlyoutItems"
AutomationId="FlyoutItems"
FlyoutItemIsVisible="{Binding FlyoutItemIsVisible,Mode=TwoWay}"
FlyoutDisplayOptions="{Binding FlyoutDisplayOptions,Mode=TwoWay}">
<ShellContent Title="Home"
AutomationId="Home">
<ContentPage AutomationId="HomeContentPage">
<ContentPage.ToolbarItems>
<ToolbarItem AutomationId="Options"
Text="Options"
Clicked="NavigateToOptionsPage_Clicked"/>
</ContentPage.ToolbarItems>
<VerticalStackLayout Padding="20">
<Label Text="This is Home page content."
FontAttributes="Bold"
FontSize="18"
TextColor="DarkBlue"
AutomationId="HomePageTitle"/>
<Label Text="{Binding CurrentItemTitle, StringFormat='Current Item: {0}'}"
FontSize="14"
TextColor="Gray"
AutomationId="HomeCurrentItemLabel"/>
</VerticalStackLayout>
</ContentPage>
</ShellContent>

<ShellContent Title="Reports"
AutomationId="Reports">
<ContentPage AutomationId="ReportsContentPage">
<VerticalStackLayout Padding="20">
<Label Text="This is Reports page content."
FontAttributes="Bold"
FontSize="18"
TextColor="DarkGreen"
AutomationId="ReportsPageTitle"/>
<Label Text="{Binding CurrentItemTitle, StringFormat='Current Item: {0}'}"
FontSize="14"
TextColor="Gray"
AutomationId="ReportsCurrentItemLabel"/>
</VerticalStackLayout>
</ContentPage>
</ShellContent>
</FlyoutItem>

<MenuItem Text="OpenFlyout"
Clicked="OnOpenFlyoutClicked"
AutomationId="OpenFlyout"/>
<MenuItem Text="FlyoutBehavior"
Clicked="OnSetFlyoutBehaviorClicked"
AutomationId="FlyoutBehavior"/>
</Shell>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.ComponentModel;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

public partial class ShellFlyoutControlPage : Shell
{
private ShellViewModel _viewModel;

public ShellFlyoutControlPage()
{
InitializeComponent();
_viewModel = new ShellViewModel();
BindingContext = _viewModel;
this.Navigated += (s, e) => _viewModel.CurrentItemTitle = CurrentItem?.CurrentItem?.Title ?? "Home";
GenerateMenuItems();
}
private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e)
{
BindingContext = _viewModel = new ShellViewModel(); // Create fresh ViewModel to reset all flyout properties to defaults
await Navigation.PushAsync(new ShellFlyoutOptionsPage(_viewModel));
}
private const int MenuItemCount = 40;
private const string MenuItemPrefix = "MenuItem";
private void GenerateMenuItems()
{
for (int i = 1; i <= MenuItemCount; i++)
{
var itemId = $"{MenuItemPrefix}{i}";
var menuItem = new MenuItem
{
Text = itemId,
AutomationId = itemId
};
this.Items.Add(menuItem);
}
}
private void OnOpenFlyoutClicked(object sender, EventArgs e)
{
FlyoutIsPresented = !FlyoutIsPresented;
}

private void OnSetFlyoutBehaviorClicked(object sender, EventArgs e)
{
if (Application.Current.MainPage is Shell shell)
{
shell.FlyoutBehavior = FlyoutBehavior.Flyout;
}
}
}
Loading
Loading