Flyout behind Appbar

前端 未结 1 1496
说谎
说谎 2021-01-20 02:56

When you want your app to expand to the full screen (including status bar and appbar), you have to do :

var applicationView = Windows.UI.ViewManagement.Appli         


        
1条回答
  •  -上瘾入骨i
    2021-01-20 03:21

    I can't seem to solve my issue (or someone who can help). So i did it that way, if it can help someone :

    
            
                
                    
                        
                            
                            
                            
                        
                    
                
            
        
    
    private void MenuFlyout_Opened(object sender, object e)
    {
      BottomAppBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
    }
    
    private void MenuFlyout_Closed(object sender, object e)
    {
      BottomAppBar.Visibility = Windows.UI.Xaml.Visibility.Visible;
    }
    

    Now my flyout appears fully, since there is no more appbar. For mvvm list view items, i did it in a behavior action :

    
            
    
                
                    
                        
                    
                
    
                
                    
                        
                        
                        
                    
                
            
        
    
    
    
    
    public class OpenFlyoutAction : DependencyObject, IAction
        {
            public object Execute(object sender, object parameter)
            {
                // Show menu
                FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);
    
                // sometimes the appbar is stuck behind the appbar, so hide the appbar
                (sender as FrameworkElement).GetFirstAncestorOfType().BottomAppBar.Visibility = Visibility.Collapsed;
    
                // show the appbar again when flyout is closed
                var flyout = FlyoutBase.GetAttachedFlyout((FrameworkElement)sender);
                EventHandler showBar = null;
                showBar = delegate (object s, object e)
                {
                    (sender as FrameworkElement).GetFirstAncestorOfType().BottomAppBar.Visibility = Visibility.Visible;
                    // unsubscribe handler:
                    flyout.Closed -= showBar;
                };
                flyout.Closed += showBar;
    
                return null;
            }
        }
    
        

    0 讨论(0)
    提交回复
    热议问题