語言

FileSavePicker.SuggestedFolder 屬性

定義

建議使用者儲存檔案的資料夾。

public:
 property Platform::String ^ SuggestedFolder { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring SuggestedFolder();

void SuggestedFolder(winrt::hstring value);
public string SuggestedFolder { get; set; }
var string = fileSavePicker.suggestedFolder;
fileSavePicker.suggestedFolder = string;
Public Property SuggestedFolder As String

屬性值

String

Platform::String

winrt::hstring

取得或設定檔案選擇器的建議資料夾名稱。

範例

以下範例示範如何在 WinUI 應用程式中使用 SuggestedFolder 屬性:

var savePicker = new Microsoft.Windows.Storage.Pickers.FileSavePicker(this.AppWindow.Id)
{
    // (Optional) Sets the folder that the file save dialog displays when it opens.
    SuggestedFolder = @"C:\MyFiles"
};
FileSavePicker savePicker(AppWindow().Id());

// (Optional) Sets the folder that the file save dialog displays when it opens.
savePicker.SuggestedFolder = L"C:\\MyFiles";

備註

此屬性僅為建議,並不保證檔案會被儲存在指定的資料夾中。 如果未指定或指定路徑不存在,則預設為使用者最後造訪的資料夾。

適用於