protected virtual void UpdateDrawerLockMode(FlyoutBehavior behavior) { switch (behavior) { case FlyoutBehavior.Disabled: CloseDrawers(); Shell.SetValueFromRenderer(Shell.FlyoutIsPresentedProperty, false); _currentLockMode = LockModeLockedClosed; SetDrawerLockMode(_currentLockMode); _content.SetPadding(0, _content.PaddingTop, _content.PaddingRight, _content.PaddingBottom); break; case FlyoutBehavior.Flyout: _currentLockMode = LockModeUnlocked; SetDrawerLockMode(_currentLockMode); _content.SetPadding(0, _content.PaddingTop, _content.PaddingRight, _content.PaddingBottom); break; case FlyoutBehavior.Locked: Shell.SetValueFromRenderer(Shell.FlyoutIsPresentedProperty, true); _currentLockMode = LockModeLockedOpen; SetDrawerLockMode(_currentLockMode); _content.SetPadding(_flyoutWidth, _content.PaddingTop, _content.PaddingRight, _content.PaddingBottom); break; } unchecked { SetScrimColor(behavior == FlyoutBehavior.Locked ? Color.Transparent.ToAndroid() : (int)DefaultScrimColor); } }
protected virtual void UpdateDrawerLockMode(FlyoutBehavior behavior) { AddFlyoutContentToLayoutIfNeeded(behavior); switch (behavior) { case FlyoutBehavior.Disabled: CloseDrawers(); Shell.SetValueFromRenderer(Shell.FlyoutIsPresentedProperty, false); _currentLockMode = LockModeLockedClosed; SetDrawerLockMode(_currentLockMode); _content.SetPadding(0, _content.PaddingTop, _content.PaddingRight, _content.PaddingBottom); break; case FlyoutBehavior.Flyout: _currentLockMode = LockModeUnlocked; SetDrawerLockMode(_currentLockMode); _content.SetPadding(0, _content.PaddingTop, _content.PaddingRight, _content.PaddingBottom); break; case FlyoutBehavior.Locked: Shell.SetValueFromRenderer(Shell.FlyoutIsPresentedProperty, true); _currentLockMode = LockModeLockedOpen; SetDrawerLockMode(_currentLockMode); _content.SetPadding((int)FlyoutWidth, _content.PaddingTop, _content.PaddingRight, _content.PaddingBottom); break; } UpdateScrim(_scrimBrush); }
void IFlyoutBehaviorObserver.OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { switch (behavior) { case FlyoutBehavior.Disabled: IsPaneToggleButtonVisible = false; IsPaneVisible = false; PaneDisplayMode = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.LeftMinimal; IsPaneOpen = false; break; case FlyoutBehavior.Flyout: IsPaneVisible = true; IsPaneToggleButtonVisible = true; bool shouldOpen = Shell.FlyoutIsPresented; PaneDisplayMode = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.LeftMinimal; //This will trigger opening the flyout IsPaneOpen = shouldOpen; break; case FlyoutBehavior.Locked: IsPaneVisible = true; IsPaneToggleButtonVisible = false; PaneDisplayMode = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Left; break; } }
void IFlyoutBehaviorObserver.OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { bool closeAfterUpdate = (behavior == FlyoutBehavior.Flyout && _behavior == FlyoutBehavior.Locked); _behavior = behavior; UpdateDrawerLockMode(behavior); if (closeAfterUpdate) { CloseDrawer(_flyoutContent.AndroidView, false); } }
void IFlyoutBehaviorObserver.OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { _flyoutBehavior = behavior; if (behavior == FlyoutBehavior.Locked) { IsOpen = true; } else if (behavior == FlyoutBehavior.Disabled) { IsOpen = false; } LayoutSidebar(false); }
void IFlyoutBehaviorObserver.OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { if (_flyoutBehavior == behavior) { return; } _flyoutBehavior = behavior; if (Page != null) { UpdateLeftBarButtonItem(); } }
public static DrawerBehavior ToPlatform(this FlyoutBehavior behavior) { if (behavior == FlyoutBehavior.Disabled) { return(DrawerBehavior.Disabled); } else if (behavior == FlyoutBehavior.Locked) { return(DrawerBehavior.Locked); } else { return(DrawerBehavior.Drawer); } }
void AddFlyoutContentToLayoutIfNeeded(FlyoutBehavior behavior) { if (behavior == FlyoutBehavior.Disabled) { return; } if (_flyoutContent == null && ChildCount > 0) { _flyoutContent = _shellContext.CreateShellFlyoutContentRenderer(); UpdateFlyoutSize(); AddView(_flyoutContent.AndroidView); } }
void IFlyoutBehaviorObserver.OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { AddFlyoutContentToLayoutIfNeeded(behavior); if (_flyoutContent?.AndroidView == null) { return; } bool closeAfterUpdate = (behavior == FlyoutBehavior.Flyout && _behavior == FlyoutBehavior.Locked); _behavior = behavior; UpdateDrawerLockMode(behavior); if (closeAfterUpdate) { CloseDrawer(_flyoutContent.AndroidView, false); } }
void IFlyoutBehaviorObserver.OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { switch (behavior) { case FlyoutBehavior.Disabled: PreferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden; PresentsWithGesture = false; break; case FlyoutBehavior.Flyout: PreferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden; PresentsWithGesture = true; _isPresented = false; _context.Shell.SetValueFromRenderer(Shell.FlyoutIsPresentedProperty, false); break; case FlyoutBehavior.Locked: PreferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible; break; } _flyoutBehavior = behavior; }
public async void OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { _flyoutBehavior = behavior; await UpdateToolbarItems().ConfigureAwait(false); }
void IFlyoutBehaviorObserver.OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { UpdateFlyoutBehavior(); }
public void OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { _flyoutBehavior = behavior; UpdateToolbarItems().FireAndForget(); }
public virtual void LayoutViews(CGRect bounds, nfloat openPercent, UIView flyout, UIView shell, FlyoutBehavior behavior) { if (behavior == FlyoutBehavior.Locked) { openPercent = 1; } nfloat flyoutHeight; nfloat flyoutWidth; if (Width != -1d) { flyoutWidth = (nfloat)Width; } else if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { flyoutWidth = 320; } else { flyoutWidth = (nfloat)(Math.Min(bounds.Width, bounds.Height) * 0.8); } if (Height == -1d) { flyoutHeight = bounds.Height; } else { flyoutHeight = (nfloat)Height; } nfloat openLimit = flyoutWidth; nfloat openPixels = openLimit * openPercent; if (behavior == FlyoutBehavior.Locked) { shell.Frame = new CGRect(bounds.X + flyoutWidth, bounds.Y, bounds.Width - flyoutWidth, flyoutHeight); } else { shell.Frame = bounds; } var shellWidth = shell.Frame.Width; if (shell.SemanticContentAttribute == UISemanticContentAttribute.ForceRightToLeft) { var positionY = shellWidth - openPixels; flyout.Frame = new CGRect(positionY, 0, flyoutWidth, flyoutHeight); } else { flyout.Frame = new CGRect(-openLimit + openPixels, 0, flyoutWidth, flyoutHeight); } }
public void LayoutViews(CGRect bounds, nfloat openPercent, UIView flyout, UIView shell, FlyoutBehavior behavior) { if (behavior == FlyoutBehavior.Locked) { openPercent = 1; } nfloat flyoutWidth = (nfloat)(Math.Min(bounds.Width, bounds.Height) * 0.8); nfloat openLimit = flyoutWidth; nfloat openPixels = openLimit * openPercent; if (behavior == FlyoutBehavior.Locked) { shell.Frame = new CGRect(bounds.X + flyoutWidth, bounds.Y, bounds.Width - flyoutWidth, bounds.Height); } else { shell.Frame = bounds; } var shellWidth = shell.Frame.Width; if (shell.SemanticContentAttribute == UISemanticContentAttribute.ForceRightToLeft) { var positionY = shellWidth - openPixels; flyout.Frame = new CGRect(positionY, 0, flyoutWidth, bounds.Height); } else { flyout.Frame = new CGRect(-openLimit + openPixels, 0, flyoutWidth, bounds.Height); } if (behavior != FlyoutBehavior.Locked) { var shellOpacity = (nfloat)(0.5 + (0.5 * (1 - openPercent))); shell.Layer.Opacity = (float)shellOpacity; } }
void IFlyoutBehaviorObserver.OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { }
void IFlyoutBehaviorObserver.OnFlyoutBehaviorChanged(FlyoutBehavior behavior) { _behavior = behavior; UpdateDrawerLockMode(behavior); }
public static Shell FlyoutBehavior(this Shell shell, FlyoutBehavior behavior) { shell.FlyoutBehavior = behavior; return(shell); }
public static void SetFlyoutBehavior(BindableObject obj, FlyoutBehavior value) => obj.SetValue(FlyoutBehaviorProperty, value);
public void LayoutViews(CGRect bounds, nfloat openPercent, UIView flyout, UIView shell, FlyoutBehavior behavior) { flyout.Frame = new CGRect(0, 0, 0, 0); }
public void LayoutViews(CGRect bounds, nfloat openPercent, UIView flyout, UIView shell, FlyoutBehavior behavior) { if (behavior == FlyoutBehavior.Locked) { openPercent = 1; } nfloat flyoutWidth = (nfloat)(Math.Min(bounds.Width, bounds.Height) * 0.8); nfloat openLimit = flyoutWidth; nfloat openPixels = openLimit * openPercent; if (behavior == FlyoutBehavior.Locked) { shell.Frame = new CGRect(bounds.X + flyoutWidth, bounds.Y, bounds.Width - flyoutWidth, bounds.Height); } else { shell.Frame = bounds; } flyout.Frame = new CGRect(-openLimit + openPixels, 0, flyoutWidth, bounds.Height); if (behavior != FlyoutBehavior.Locked) { var shellOpacity = (nfloat)(0.5 + (0.5 * (1 - openPercent))); shell.Layer.Opacity = (float)shellOpacity; } }
public static T FlyoutBehavior <T>(this T shell, FlyoutBehavior flyoutBehavior) where T : IRxShell { shell.FlyoutBehavior = flyoutBehavior; return(shell); }