Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/UdaraAlwis/XFShellAdvThemeing
Stunning App themes with Xamarin Forms Shell!
https://github.com/UdaraAlwis/XFShellAdvThemeing
shell styles themes xamarin xamarin-forms
Last synced: 30 days ago
JSON representation
Stunning App themes with Xamarin Forms Shell!
- Host: GitHub
- URL: https://github.com/UdaraAlwis/XFShellAdvThemeing
- Owner: UdaraAlwis
- License: gpl-3.0
- Created: 2019-12-17T17:29:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-20T00:48:12.000Z (over 4 years ago)
- Last Synced: 2024-08-03T23:20:24.223Z (4 months ago)
- Topics: shell, styles, themes, xamarin, xamarin-forms
- Language: C#
- Size: 6.44 MB
- Stars: 11
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xamarin-forms - XFShellAdvThemeing ★10
README
# XFShellAdvThemeing
Stunning App themes with Xamarin Forms Shell!You probably already know how to in classic Xamarin.Forms, but how about Setting up App Themes in a Xamarin.Forms Shell App?, now that's what this is for. 😉
Check out the blog post: https://theconfuzedsourcecode.wordpress.com/2019/12/26/stunning-app-themes-in-xamarin-forms-shell-projects/
A little sneak peak:
![Android](/screenshots/PreviewStepByStepDemoAndroid.png)>Here we're using awesome built-in Xamarin.Forms Dynamic Binding, and Styling features to implement a neat App Theming solution.
>An alternative for: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/theming
>But focused on the awesome new paradigm of Xamarin.Forms Shell!### In a nutshell:
- Define Theme files with Colors/Fonts/Images/Icons in them
- Create Styles based on the Theme properties using Dynamic Binding
- Bind the UI Elements to the Styles created earlier
- Implement dynamic App Theme selection using MergedDictionaries
- Use XF.Essentials Preferences API to save App Theme preferencesSample Theme File:
```xaml
#fc0384
#ffb8dd
WhiteWhite
#fc0384#3d0020
#610033
#960050```
Sample Style:
```xaml
<Setter Property="BackgroundColor" Value="{DynamicResource PrimaryColor}" />
<Setter Property="TextColor" Value="{DynamicResource SecondaryColor}" />
<Setter Property="HeightRequest" Value="45" />
<Setter Property="WidthRequest" Value="190" />```
Sample UI Element:
```xaml
```
Dynamic App Theme Switching:
```csharp
ICollection mergedDictionaries
= Application.Current.Resources.MergedDictionaries;
...
...
case Theme.Pink:
mergedDictionaries.Add(new PinkTheme());
break;
...
...
```Saving Theme Preferences:
```csharp
Preferences.Set("CurrentAppTheme", SelectedItem.ToString());
```Behold the beauty on Android and iOS...
![Android](/screenshots/PreviewCollectionAndroid.png)
![iOS](/screenshots/PreviewCollectioniOS.png)