Exemplo n.º 1
0
        protected override bool DoesNodeReferenceUrl(DocumentNode node, string url)
        {
            DocumentCompositeNode documentCompositeNode = node as DocumentCompositeNode;

            if (documentCompositeNode != null)
            {
                Uri    uriValue  = DocumentNodeHelper.GetUriValue(documentCompositeNode.Properties[ImageElement.SourceProperty]);
                string uriString = uriValue != (Uri)null ? uriValue.OriginalString : (string)null;
                if (!string.IsNullOrEmpty(uriString))
                {
                    Uri uri = node.Context.MakeDesignTimeUri(new Uri(uriString, UriKind.RelativeOrAbsolute));
                    if (!uri.IsAbsoluteUri)
                    {
                        return(false);
                    }
                    string localPath = uri.LocalPath;
                    if (StringComparer.OrdinalIgnoreCase.Compare(localPath, url) == 0)
                    {
                        return(true);
                    }
                    return(StringComparer.OrdinalIgnoreCase.Compare(localPath.Replace("file:///", "").Replace("/", "\\"), url) == 0);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        protected override object GetComputedValueInternal(PropertyReference propertyReference)
        {
            if (propertyReference.Count != 1 || !ImageElement.SourceProperty.Equals((object)propertyReference.FirstStep))
            {
                return(base.GetComputedValueInternal(propertyReference));
            }
            SceneNode valueAsSceneNode = this.GetLocalValueAsSceneNode(propertyReference);

            if (valueAsSceneNode != null && valueAsSceneNode.TargetType == typeof(BitmapImage))
            {
                return((object)DocumentNodeHelper.GetUriValue(valueAsSceneNode.DocumentNode));
            }
            return(this.GetLocalOrDefaultValue(propertyReference));
        }