我在日志文件页面上有一个保存按钮,当我单击该按钮时,将打开一个文件选择器。问题是当我导航到应用程序中的其他页面时,此文件选择器会丢失。 因此,在导航并返回到日志文件页面后,此文件选择器将丢失。
<Button Margin="4,0,0,0" Width="140" Background="Transparent" Foreground="{StaticResource AbbGrey-15}" Content="Save Log" Command="{Binding EventLogs.SaveControllerCommand}"/>
。
public ICommand SaveControllerCommand => new RelayCommand(Save, o => true);
。
private async void Save(object obj)
{
if (ShowDialog == false)
{
ShowDialog = true;
FileFolderPickerModalDialog pickerDlg = new FileFolderPickerModalDialog(cvm.Connection);
CustomModalDialog dlg = new CustomModalDialog(pickerDlg);
StatusBarVM.Instance.HideStatusBar();
Apps.AppCore.BaseLayouts.RootPage rootPage = Window.Current.Content as Apps.AppCore.BaseLayouts.RootPage;
var contentFrame = (rootPage.FindName("MainBodyContent") as ContentControl).Content as Frame;
await dlg.ShowAsync(contentFrame);
ShowDialog = false;
}
}