Popup LightDismissEnabled with scrollable

guess_me_if_u_can 126 Reputation points
2021-01-28T16:00:54.817+00:00

I am showing a popup in a scrollable area. If the popup is light dismiss enabled, i am unable to scroll the area. whereas if it not light dismiss enabled,then i can able to scroll the area. In my case, i need my popup to be light dismissed with scrollable area.

61503-image.png

Kindly help me to achieve my requirement. Thanks in advance

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,866 Reputation points
    2021-01-29T01:55:11.137+00:00

    Hello @guess_me_if_u_can , Welcome to Micorosoft Q&A,

    . If the popup is light dismiss enabled, i am unable to scroll the area.

    It's by design, if we set IsLightDismissEnabled as true, that specifies whether the area outside of a light-dismiss UI will listen tap event, so it will not response scrolling, for your requirement, we suggest you set IsLightDismissEnabled as true, and implement light dismiss manually.

    public sealed partial class MainPage : Page  
    {  
        public MainPage()  
        {  
            this.InitializeComponent();  
            Window.Current.Content.Tapped += Content_Tapped;  
            popup.Opened += Popup_Opened;  
            popup.Closed += Popup_Closed;  
        }  
      
        private void Content_Tapped(object sender, TappedRoutedEventArgs e)  
        {  
            if (_isOpen)  
            {  
                popup.IsOpen = false;  
            }  
        }  
        private void Popup_Closed(object sender, object e)  
        {  
            _isOpen = false;  
        }  
      
        private bool _isOpen;  
        private void Popup_Opened(object sender, object e)  
        {  
            _isOpen = true;  
        }  
      
        private void Button_Click(object sender, RoutedEventArgs e)  
        {  
            popup.IsOpen = true;  
      
        }  
          
    }  
    

    Why not use popup.IsOpen as condition, because when click button the, the clicking will bubble up to window content that cause popup will disappear before it can be displayed.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.