Skip to content

Instantly share code, notes, and snippets.

@adamped
Created January 9, 2016 09:11
Show Gist options
  • Save adamped/129a725b3d6a84f92f83 to your computer and use it in GitHub Desktop.
Save adamped/129a725b3d6a84f92f83 to your computer and use it in GitHub Desktop.
Merging Styles from one Resources Dictionary to another
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