public void TestResourceDictionaryUriSetToMissingResourceThrowsException()
        {
            Panel stackPanel = new StackPanel();
            Uri   uri        = new Uri("System.Windows.Controls.Testing.Theming;component/ImplicitStyleManager/non-existantresource.xaml", UriKind.Relative);

            ImplicitStyleManager.SetResourceDictionaryUri(stackPanel, uri);
        }
        public void TestResourceDictionaryUriSetAndGet()
        {
            Panel stackPanel = new StackPanel();
            Uri   uri        = new Uri("System.Windows.Controls.Testing.Theming;component/ImplicitStyleManager/OuterStyleResourceDictionary.xaml", UriKind.Relative);

            ImplicitStyleManager.SetResourceDictionaryUri(stackPanel, uri);
            Assert.AreSame(ImplicitStyleManager.GetResourceDictionaryUri(stackPanel), uri);
        }
        /// <summary>
        /// Applies the style.
        /// </summary>
        /// <param name="uri">The URI of the theme used.</param>
        internal void ApplyStyle(Uri uri)
        {
            ImplicitStyleManager.SetResourceDictionaryUri(this, uri);
            ImplicitStyleManager.SetApplyMode(this, ImplicitStylesApplyMode.OneTime);
            ImplicitStyleManager.Apply(this);

            // explicitly set content of expander.
            ImplicitStyleManager.SetApplyMode(expander.Content as FrameworkElement, ImplicitStylesApplyMode.OneTime);
            ImplicitStyleManager.Apply(expander.Content as FrameworkElement);
        }
        public void TestResourceDictionaryUriSetOnNullElementThrowsException()
        {
            Uri uri = new Uri("System.Windows.Controls.Testing.Theming;component/ImplicitStyleManager/OuterStyleResourceDictionary.xaml", UriKind.Relative);

            ImplicitStyleManager.SetResourceDictionaryUri((FrameworkElement)null, uri);
        }
 /// <summary>
 /// Associates a resource dictionary uri with an element.
 /// </summary>
 /// <param name="element">The element to associate the uri with.</param>
 /// <param name="uri">The uri of a resource dictionary.</param>
 public static void SetResourceDictionaryUri(FrameworkElement element, Uri uri)
 {
     ImplicitStyleManager.SetResourceDictionaryUri(element, uri);
 }