Maui
Maui copied to clipboard
[Proposal] SideMenuView
SideMenuView
- [x] Proposed
- [ ] Prototype: Not Started
- [ ] Implementation: Not Started
- [ ] iOS Support
- [ ] Android Support
- [ ] macOS Support
- [ ] Windows Support
- [ ] Unit Tests: Not Started
- [ ] Sample: Not Started
- [ ] Documentation: Not Started
Summary
Adds a swipe-able side menu
Detailed Design
SideMenuView.shared.cs
[ContentProperty(nameof(Children))]
public class SideMenuView : BaseTemplatedView<AbsoluteLayout>
{
public static readonly BindableProperty ShiftProperty;
public static readonly BindableProperty CurrentGestureShiftProperty;
public static readonly BindableProperty GestureThresholdProperty;
public static readonly BindableProperty CancelVerticalGestureThresholdProperty;
public static readonly BindableProperty StateProperty;
public static readonly BindableProperty CurrentGestureStateProperty;
public static readonly BindableProperty PositionProperty;
public static readonly BindableProperty MenuWidthPercentageProperty;
public static readonly BindableProperty MenuGestureEnabledProperty;
public static readonly BindableProperty MainViewScaleFactorProperty;
public static readonly BindableProperty MainViewOpacityFactorProperty;
public static readonly BindableProperty MenuAppearanceTypeProperty;
public static readonly BindableProperty ParallaxValueProperty;
public new ISideMenuList<View> Children { get; }
public double Shift { get; set; }
public double CurrentGestureShift { get; set; }
public double GestureThreshold { get; set; }
public double CancelVerticalGestureThreshold { get; set; }
public SideMenuState State { get; set; }
public SideMenuState CurrentGestureState { get; set; }
public static SideMenuPosition GetPosition(BindableObject bindable);
public static void SetPosition(BindableObject bindable, SideMenuPosition value);
public static double GetMenuWidthPercentage(BindableObject bindable);
public static void SetMenuWidthPercentage(BindableObject bindable, double value);
public static bool GetMenuGestureEnabled(BindableObject bindable);
public static void SetMenuGestureEnabled(BindableObject bindable, bool value);
public static double GetMainViewScaleFactor(BindableObject bindable);
public static void SetMainViewScaleFactor(BindableObject bindable, double value);
public static double GetMainViewOpacityFactor(BindableObject bindable);
public static void SetMainViewOpacityFactor(BindableObject bindable, double value);
public static SideMenuAppearanceType GetMenuAppearanceType(BindableObject bindable);
public static void SetMenuAppearanceType(BindableObject bindable, SideMenuAppearanceType value);
public static double GetParallaxValue(BindableObject bindable);
public static void SetParallaxValue(BindableObject bindable, double value);
}
Usage Syntax
XAML Usage
<StackLayout
xct:SideMenuView.ParallaxValue="50"
xct:SideMenuView.MenuAppearanceType="SlideIn"
xct:SideMenuView.Position="LeftMenu"
xct:SideMenuView.MenuWidthPercentage=".5"
xct:SideMenuView.MainViewScaleFactor=".95"
xct:ShadowEffect.Color="Black"
BackgroundColor="Orange">
<Label Text="LEFT MENU" />
</StackLayout>
C# Usage
Content = new SideMenuView
{
ParallaxValue = 50,
MenuAppearanceType = SideMenuAppearanceType.SlideIn,
Position = SideMenuPosition.LeftMenu,
MenuWidthPercentage = 0.5,
MainViewScaleFactor = 0.95
Children = new StackLayout
{
BackgroundColor = Colors.Orange,
Children =
{
new Label { Text = "Left Menu" }
}
}