Settings for UWP Applications
V 0.2
- WindowDialog
- SettingsPane
- Badges
- AchievementsPane
- Crostinis (In App Toasts)
The purpose of this small library is to organize in one place all the secondary content, settings and actions in a place similar like the OS Settings.
It is useful when having sections like Settings, About, Shortcuts, Help, Quests, Website, More apps, Rate, etc. and the app contains many places with buttons for those actions.
All details are easy to understand in the ExamplesJobs.cs class
The Window Dialog is opened with the WindowManager, it contains the logic to open a modal content dialog with titlebar with an option to 'navigate' to a IsDetail section. You can set a header and icon header to simplify tasks.
private async void LaunchExampleSeven()
{
var customcontrol = new CustomControl();
await WindowManager.ShowWindowDialog(customcontrol,"Menu", "\uE734");
}
Sometimes we need to show a toast, to show progress or a visual reaction of an action that is does not worth to show like a generic toast. In these situations you can use a Crostini that supports:
- Show for a few seconds
- Open in indeterminate mode and close by code
- Show a Crostini with also an UIElement
In the Examples projects are detailed how it is used each, for instance:
private async void LaunchExampleFour()
{
await Crostini.ShowNotification("File exported", icon: "\uE008", seconds: 4);
}
The purpose is in future releases create quests instead of boring tutorials, and when the action to achieve a badge is done, you can set a Badge earned.
NOTE: The color is string with the hex value to be easy to store as data object
As you can see it support several properties and is all XAML not a bitmap like the 'Feedback Hub' badges. You can choose the color you want or choose one Accent Color, You can look up the correspondence in UWP Technical guide -> Colors -> Accent, Download the app from the Store: UWP Techical guide
Example on how to create a Badge:
var badge = new Badge("Feedback phenom", "Submit 50 posts", Badge.StarNumbers.Three, true, DateTime.Now, ThemeColors.Orange16, "\uED15");
You have the easy option tho launch a window dialog with the achievements pane that has a list of badges in few lines.
Example:
private async void LaunchExampleSeven()
{
var list = ExampleJobs.SampleBadges();
var achievements = new AchievementsPane();
achievements.ItemsSource = list;
await WindowManager.ShowWindowDialog(achievements,"Achievements", "\uE734");
}
With the Settings class definition, you can create a List of them specifying per each:
- An Uri (website,rating,store, markdown file)
- A Type of UIElement for the Details.
- An Action of Setting, to customize the event.
- Depending on the URI it will open the link in the webbrowser,the store or a valid link.
- If the uri contains an ms-appx content with MarkDown (.md) file it will show a details element with the content.
- If you specify a type of your app user controls, it will show in the details pane.
- In case you want to create a custom action set it in the constructor of the Setting.
- Responsive design with Visual States.
- Dark and Light Theme aware.
- Experimental Open in a new Window.
- Navigate directly to details in settings
- Create a Configuration Manager to I/O values.
- Create ViewModel for the example and watch values changing from settings to the view.
- Implement Quests.
- Implement Feedback.
- Create more specific details sections.
In order to support markdown it is required the UWP Community Toolkit. In case you need to avoid it, you can remove easily the part of MarkDown.
If you found the library useful ☺, you can donate here donations, Thank you!.
More information about my apps and development at @juanpaexpedite and in my blog
You can donate here donate, Thank you!