These Playlists will continue to be reordered and updated in real time as new content becomes available. However, the links will always remain the same and you can refresh the playlist page to get any updated ordering/content.
If you’re a Xamarin Forms developer, you’ve likely used PCLStorage (or other Dependency Service) to interact with the target platform’s file system in the portable class library’s code. However, since November 2017, Xamarin.Forms now uses a .NET Standard 2.0 class library and PCLStorage is no longer supported.
Telerik UI for Xamarin comes with two themes out of the box, Default and Blue. You can easily style individual items, but you can also define an entire theme at once in a separate ResourceDictionary.
With this approach you can swap out ResourceDictionaries at runtime for a nice user-selected theme feature in your app’s settings. Let me walk you through a very simple demo to illustrate the approach.
Step 1. Create your custom theme’s ResourceDictionary
Xamarin.Forms doesn’t have a good ResourceDictionary template, so start with a Content Page (XAML) template and then change the ContentPage type to “ResourceDictionary” in both the XAML and code-behind.
Now, you can add in all the styles and colors you want in that one dictionary. You can find the Color names we use for your controls in the Themes Overview documentation.
In the custom dark theme example below, the Color resource key values are pretty clear as to what they do.
Step 2. ThemeHelper Class
I usually like to create a static class like this so that I can change the theme from anywhere in the app, but isn’t necessary. You can put this logic entirely in your settings page if you’d prefer.
You may have noticed that I’m using a RadResourceDictionary. We created this when Xamarin.Forms didn’t have MergeWith support. You can use a Xamarin.Forms ResourceDictionary type if you’re using a newer version that supports it.
Step 3. Runtime
I’m using a RadSegmentedControl to change the theme, and a RadListView to easily see the difference between themes. You can of course use whatever UI control you’d like to change themes, for example a Picker.
The important thing is that you call the helper class’s ChangeTheme method and pass the theme name that you need to change to:
When selecting one of the options, you’ll get one of the three results you see in this article’s header image.
If you have any questions feel free to reach out to me on Twitter at @lancewmccarthy.