FolderPicker.SuggestedStartLocation プロパティ

定義

ユーザーに表示するフォルダーをフォルダー ピッカーが検索する最初の場所を取得または設定します。

public:
 property PickerLocationId SuggestedStartLocation { PickerLocationId get(); void set(PickerLocationId value); };
PickerLocationId SuggestedStartLocation();

void SuggestedStartLocation(PickerLocationId value);
public PickerLocationId SuggestedStartLocation { get; set; }
var pickerLocationId = folderPicker.suggestedStartLocation;
folderPicker.suggestedStartLocation = pickerLocationId;
Public Property SuggestedStartLocation As PickerLocationId

プロパティ値

開始場所の識別子。

ファイル ピッカーのサンプルでは、ファイル ピッカーで任意の種類のファイルを表示する方法を示します。

この短いサンプル コードは、要求された場所で FilePicker を開く方法を示しています。

private async void Button_click(object sender, RoutedEventArgs e)
{
    FileOpenPicker filePicker = new FileOpenPicker();
    filePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
    filePicker.ViewMode = PickerViewMode.List;
    filePicker.FileTypeFilter.Add(".txt");
    StorageFile file = await filePicker.PickSingleFileAsync();
}

注釈

SuggestedStartLocation は、フォルダー ピッカーの開始場所として常に使用されるとは限りません。 ユーザーに一貫性を感じさせるために、フォルダー ピッカーはユーザーが最後に移動した場所を記憶し、通常はその場所から開始します。

適用対象