I have created a custom AlarmSettingsPane in the settings charm which allows the user to give the time and also choose the audio file for alarm tone. So i implemented the file picker in the settings charm.When i click the file picker button it takes me to a new full screen where i get to pick my files, but when i select a file and open it, am directed to my home screen but the settings charm flyout gets closed. How can i preserve the state of the AlarmSettingsPane flyout and prevent it from closing programmatically? Like the settings flyout should contain the same imfo about the alarm as it was before i selected the file.
SettingsPane.Show() opens the settings charm but does not go to the alarm setting i created inside the standard settings flyout.
Please let me know if you any idea at all. Thanks
here's my code for the file picker button click event
private async void PickAFileButton_Click(object sender, RoutedEventArgs e)
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary;
openPicker.FileTypeFilter.Add(".mp3");
openPicker.FileTypeFilter.Add(".wma");
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
// Application now has read/write access to the picked file
CustomSound.Text = file.Name;
}
else
{
CustomSound.Text = "Operation cancelled.";
}
}
See if setting the IsLightDismissEnabled property of the flyout / popup to false will do the trick.
You can try to mimic PLM (Process life management) code so that whenever you your AlarmSettingsPane gets unloaded you save the content of the page and whenever it gets loaded back you reconstruct the state of the Control. you can find some sample code in layoutawarepage in VS Split or Grid template ..
regards,
What I did was grab a copy of the UserControl.Parent before the Picker is called and store it locally in the function, this prevents the UI handlers from marking it for collection, and after the picker returns, then select the parent IsOpen back to true.
for instance:
It may not be the best by the book, but it does work well.