FolderPicker.SuggestedStartLocation Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
The identifier of the starting location.
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();
}
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.