Пример #1
0
        internal bool IsPrototypingStyle(StyleAsset styleAsset)
        {
            ResourceDictionaryAssetProvider dictionaryAssetProvider = styleAsset.Provider as ResourceDictionaryAssetProvider;

            if (dictionaryAssetProvider != null)
            {
                return((dictionaryAssetProvider.ResourceDictionaryUsage & ResourceDictionaryUsage.PrototypingStyles) != ResourceDictionaryUsage.Unknown);
            }
            return(false);
        }
Пример #2
0
        public bool ApplyStyle(SceneNode node)
        {
            BaseFrameworkElement frameworkElement = node as BaseFrameworkElement;

            if (frameworkElement == null || !this.StyleType.IsAssignableFrom((ITypeId)frameworkElement.Type))
            {
                return(false);
            }
            ResourceDictionaryAssetProvider dictionaryAssetProvider = this.Provider as ResourceDictionaryAssetProvider;

            if (dictionaryAssetProvider != null && dictionaryAssetProvider.ContentProvider != null && !dictionaryAssetProvider.ContentProvider.EnsureLinked(frameworkElement.ViewModel) || frameworkElement.DocumentNodePath.Contains(this.ResourceModel.ValueNode))
            {
                return(false);
            }
            IDocumentContext context   = frameworkElement.DocumentNode.Context;
            DocumentNode     valueNode = !JoltHelper.TypeSupported((ITypeResolver)frameworkElement.ProjectContext, PlatformTypes.DynamicResource) ? (DocumentNode)DocumentNodeUtilities.NewStaticResourceNode(context, this.ResourceModel.KeyNode.Clone(context)) : (DocumentNode)DocumentNodeUtilities.NewDynamicResourceNode(context, this.ResourceModel.KeyNode.Clone(context));

            frameworkElement.SetLocalValue(BaseFrameworkElement.StyleProperty, valueNode);
            return(true);
        }
 public NonLocalStyleAssetInstantiator(SceneView sceneView, ResourceDictionaryAssetProvider provider, NonLocalStyleAsset styleAsset)
     : base(sceneView, (StyleAssetProvider)provider, (StyleAsset)styleAsset)
 {
     this.provider = provider;
 }
Пример #4
0
 public NonLocalStyleAsset(ResourceDictionaryAssetProvider provider, ResourceModel resourceModel)
     : base((StyleAssetProvider)provider, resourceModel)
 {
     this.provider = provider;
     this.name     = resourceModel.Name;
 }