/// <summary>
        /// Attempts to load additional layout resource dictionaries if present.
        /// </summary>
        /// <param name="document">Document to attach these layouts to</param>
        /// <param name="searchPath">Search path to look in</param>
        protected virtual void TryAttachingDocumentLayoutResources(FrameworkContentElement document, string searchPath)
        {
            if (searchPath.EndsWith(".xaml"))
            {
                searchPath = searchPath.Substring(0, searchPath.Length - 5);
            }

            if (!_searchedForAppEx)
            {
                _searchedForAppEx = true;
                if (Application.Current is ApplicationEx)
                {
                    _appEx = Application.Current as ApplicationEx;
                }
            }

            if (_appEx != null && !string.IsNullOrEmpty(_appEx.Theme))
            {
                ApplyDocumentResource(document, searchPath + ".AllThemes.xaml");
                if (!ApplyDocumentResource(document, searchPath + "." + _appEx.Theme + ".xaml"))
                {
                    ApplyDocumentResource(document, searchPath + ".Default.xaml");
                }
            }

            ApplyDocumentResource(document, searchPath + ".layout.xaml");
        }
        private FrameworkElement GetViewInternal(string viewName)
        {
            var features = ApplicationEx.GetStandardThemeFeatures();

            if (features == null)
            {
                return(null);
            }

            var factory = features.StandardViewFactory;

            if (factory == null)
            {
                return(null);
            }

            return(factory.GetStandardView(viewName));
        }
Beispiel #3
0
        /// <summary>
        /// Attempts to load additional layout resource dictionaries if present.
        /// </summary>
        /// <param name="document">Document to attach these layouts to</param>
        /// <param name="searchPath">Search path to look in</param>
        protected virtual void TryAttachingDocumentLayoutResources(FrameworkContentElement document, string searchPath)
        {
            if (searchPath.EndsWith(".xaml")) searchPath = searchPath.Substring(0, searchPath.Length - 5);

            if (!_searchedForAppEx)
            {
                _searchedForAppEx = true;
                if (Application.Current is ApplicationEx)
                    _appEx = Application.Current as ApplicationEx;
            }

            if (_appEx != null && !string.IsNullOrEmpty(_appEx.Theme))
            {
                ApplyDocumentResource(document, searchPath + ".AllThemes.xaml");
                if (!ApplyDocumentResource(document, searchPath + "." + _appEx.Theme + ".xaml"))
                    ApplyDocumentResource(document, searchPath + ".Default.xaml");
            }

            ApplyDocumentResource(document, searchPath + ".layout.xaml");
        }