[英]How to dismiss a ContentDialog by tapping out site of it in Windows Phone 8.1?
I have a problem with ContentDialog, as you knew, a ContentDialog can be dismissed when we tap to its button, but now, I want to dismiss this by tapping to the out site section of it. 如您所知,ContentDialog存在问题,当我们点击它的按钮时,可以关闭ContentDialog,但是现在,我想通过点击它的外部站点部分来关闭它。 How to do that? 怎么做? Please help me! 请帮我!
When you calling the ShowAsync method of ContentDialog pass the CancellationTokenSource(cts); 当您调用ContentDialog的ShowAsync方法时,传递CancellationTokenSource(cts);
CancellationTokenSource cts;
cts = new CancellationTokenSource();
contentDialog.ShowAsync().AsTask(cts.Token);
listen for Tapped event of the page. 监听页面的点击事件。 Cancel the task(ContenDialog task) inside event method like below 取消事件方法中的任务(ContenDialog任务),如下所示
void Page_Tapped(object sender, TappedRoutedEventArgs e)
{
contentDialog.Hide();
cts.Cancel();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.