Created
January 9, 2016 09:11
-
-
Save adamped/129a725b3d6a84f92f83 to your computer and use it in GitHub Desktop.
Merging Styles from one Resources Dictionary to another
This file contains hidden or 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
private bool _initialView = true; | |
protected void LoadStyles() | |
{ | |
if (!_initialView) | |
return; | |
_initialView = false; | |
if (!String.IsNullOrEmpty(this.StyleSheet)) | |
{ | |
try | |
{ | |
var stylesheet = Activator.CreateInstance(Type.GetType(this.StyleSheet)) as VisualElement; | |
foreach (var resource in stylesheet.Resources) | |
this.Resources.Add(resource.Key, resource.Value); | |
} | |
catch | |
{ | |
// Failed to add stylesheet | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment