Created
June 15, 2017 02:22
-
-
Save davidortinau/18a6a052ee9684e9f76074432fca95df to your computer and use it in GitHub Desktop.
Merging Resources at runtime. Docs Guide: https://developer.xamarin.com/guides/xamarin-forms/xaml/resource-dictionaries/#Merged_Resource_Dictionaries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
x:Class="My.Project.Styles"> | |
<Style TargetType="Label"> | |
<Setter Property="TextColor" Value="Blue" /> | |
</Style> | |
... | |
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using My.Project.Styles; | |
... | |
if (App.Current.Resources == null) | |
App.Current.Resources = new ResourceDictionary(); | |
App.Current.Resources.MergedWith = typeof(MyXamlStyles); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Application ... xmlns:myTheme="clr-namespace:My.Project.Styles"> | |
<Application.Resources> | |
<ResourceDictionary MergedWith="myTheme:MyXamlStyles" /> | |
</Application.Resources> | |
... | |
</Application |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment