Dela via


FolderPicker.SuggestedStartLocation Property

Definition

Gets or sets the initial location where the folder picker looks for folders to present to the user.

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

Property Value

The identifier of the starting location.

Examples

The File picker sample demonstrates how to show files of any type in the file picker.

This short sample code demonstrates a FilePicker opening at a requested location.

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();
}

Remarks

The SuggestedStartLocation is not always used as the start location for the folder picker. To give the user a sense of consistency, the folder picker remembers the last location that the user navigated to and will generally start at that location.

Applies to