你好
我有一个简单的页面,带有一个pdfviewer和一个关闭按钮;
<StackLayout>
<dx:PdfViewer
x:Name="PdfViewer"
HorizontalOptions="FillAndExpand"
PageTap="OnPageTap"
ShowEditToolbar="False"
VerticalOptions="FillAndExpand" />
<Button
Clicked="OnCloseClicked"
HorizontalOptions="CenterAndExpand"
Text="Close"
VerticalOptions="End" />
</StackLayout>
</ContentPage.Content>
此页面的调用方式如下;
var navigationUri = $"///pdfViewerPage?pdfUri={encodedUri}";
await Shell.Current.GoToAsync(navigationUri);
页面正在通过 QueryProperty 选取参数。
一切都很好。
问题是,当单击关闭按钮并执行以下代码时,页面将保持打开状态,并且仍显示pdf文档。
private async void OnCloseClicked(object sender, EventArgs e)
{
PdfViewer.CloseDocument();
//Tried both below
await Shell.Current.Navigation.PopAsync();
await Navigation.PopAsync();
}
点击关闭按钮后如何关闭页面?
谢谢
此问题整理于:https://learn.microsoft.com/en-us/answers/questions/1857614/page-not-closing