public DocumentNode EvaluateTemplateBinding(DocumentNodePath nodePath, DocumentCompositeNode templateBindingNode) { DocumentNode documentNode = null; DependencyPropertyReferenceStep member = null; DocumentPrimitiveNode item = templateBindingNode.Properties[KnownProperties.TemplateBindingPropertyProperty] as DocumentPrimitiveNode; if (item != null) { DocumentNodeMemberValue value = item.Value as DocumentNodeMemberValue; if (value != null) { member = value.Member as DependencyPropertyReferenceStep; } } if (member != null) { DocumentNodePath containerOwnerPath = nodePath.GetContainerOwnerPath(); if (containerOwnerPath != null) { documentNode = this.EvaluateProperty(containerOwnerPath, member); if (documentNode == null) { DocumentCompositeNode containerNode = nodePath.ContainerNode as DocumentCompositeNode; documentNode = this.EvaluateProperty(nodePath.GetPathInContainer(containerNode), member); } } } return(documentNode); }
public DocumentNode EvaluateExpression(DocumentNodePath context, DocumentNode expression) { DocumentCompositeNode documentCompositeNode = expression as DocumentCompositeNode; DocumentCompositeNode documentCompositeNode1 = documentCompositeNode; if (documentCompositeNode == null) { DocumentPrimitiveNode documentPrimitiveNode = expression as DocumentPrimitiveNode; DocumentPrimitiveNode documentPrimitiveNode1 = documentPrimitiveNode; if (documentPrimitiveNode != null) { DocumentNodeReferenceValue value = documentPrimitiveNode1.Value as DocumentNodeReferenceValue; if (value != null) { return(value.Value); } } } else { if (DocumentNodeUtilities.IsTemplateBinding(documentCompositeNode1)) { return(this.EvaluateTemplateBinding(context, documentCompositeNode1)); } if (documentCompositeNode1.Type.IsResource) { DocumentNode resourceKey = ResourceNodeHelper.GetResourceKey(documentCompositeNode1); if (resourceKey != null) { return(this.EvaluateResource(context, ResourceNodeHelper.GetResourceType(documentCompositeNode1), resourceKey)); } } } return(expression); }
private static void CreateImageReferenceMapHelper(PastePackage pastePackage, SceneViewModel viewModel, Dictionary <DocumentNode, string> candidateNodes, DocumentNode descendant) { DocumentPrimitiveNode documentPrimitiveNode = descendant as DocumentPrimitiveNode; if (documentPrimitiveNode == null) { return; } Uri uriValue = documentPrimitiveNode.GetUriValue(); if (uriValue == (Uri)null) { return; } foreach (KeyValuePair <string, KeyValuePair <Uri, string> > keyValuePair in pastePackage.ImageReferences) { if (keyValuePair.Key == uriValue.OriginalString) { Uri key1 = keyValuePair.Value.Key; DocumentNode key2 = (DocumentNode)viewModel.Document.DocumentContext.CreateNode((ITypeId)documentPrimitiveNode.Type, (IDocumentNodeValue) new DocumentNodeStringValue(key1.OriginalString)); if (documentPrimitiveNode.IsProperty) { documentPrimitiveNode.Parent.Properties[(IPropertyId)documentPrimitiveNode.SitePropertyKey] = key2; } else { documentPrimitiveNode.Parent.Children[documentPrimitiveNode.SiteChildIndex] = key2; } candidateNodes.Add(key2, keyValuePair.Key); } } }
public static string GetSourceFilePath(DocumentCompositeNode designDataNode) { string value = null; try { IProperty member = (IProperty)designDataNode.Type.GetMember(MemberType.LocalProperty, "Source", MemberAccessTypes.Public); DocumentPrimitiveNode item = designDataNode.Properties[member] as DocumentPrimitiveNode; if (item != null) { value = item.GetValue <string>(); Uri uri = designDataNode.Context.MakeDesignTimeUri(new Uri(value, UriKind.RelativeOrAbsolute)); value = uri.LocalPath; } else { return(null); } } catch (InvalidOperationException invalidOperationException) { } catch (IOException oException) { } return(value); }
private static IType GetDesignInstanceType(DocumentCompositeNode designInstanceNode) { if (designInstanceNode.DocumentRoot == null) { return((IType)null); } IType type = (IType)null; IProperty property1 = (IProperty)designInstanceNode.Type.GetMember(MemberType.LocalProperty, "Type", MemberAccessTypes.Public); DocumentNode dataNode = designInstanceNode.Properties[(IPropertyId)property1]; if (dataNode != null) { IType dataType = DataContextHelper.GetDataType(dataNode); if (dataType.RuntimeType == (Type)null) { return((IType)null); } IProperty property2 = (IProperty)designInstanceNode.Type.GetMember(MemberType.LocalProperty, "CreateList", MemberAccessTypes.Public); DocumentPrimitiveNode documentPrimitiveNode1 = designInstanceNode.Properties[(IPropertyId)property2] as DocumentPrimitiveNode; bool createList = documentPrimitiveNode1 != null && documentPrimitiveNode1.GetValue <bool>(); IProperty property3 = (IProperty)designInstanceNode.Type.GetMember(MemberType.LocalProperty, "IsDesignTimeCreatable", MemberAccessTypes.Public); DocumentPrimitiveNode documentPrimitiveNode2 = designInstanceNode.Properties[(IPropertyId)property3] as DocumentPrimitiveNode; bool isDesignTimeCreatable = documentPrimitiveNode2 != null && documentPrimitiveNode2.GetValue <bool>(); DesignTypeResult typeToInstantiate = DesignTypeInstanceBuilder.GetTypeToInstantiate(designInstanceNode.PlatformMetadata, dataType.RuntimeType, createList, isDesignTimeCreatable); if (typeToInstantiate.IsFailed) { return((IType)null); } type = designInstanceNode.TypeResolver.GetType(typeToInstantiate.DesignType); } return(type); }
private static DocumentNode GetTemplateNode(SceneNode newElement, DocumentCompositeNode styleNode, out StyleNode styleElement) { DocumentCompositeNode documentCompositeNode1 = styleNode.Properties[DictionaryEntryNode.ValueProperty] as DocumentCompositeNode; SceneViewModel viewModel = newElement.ViewModel.GetViewModel(documentCompositeNode1.DocumentRoot, false); if (viewModel == null) { styleElement = (StyleNode)null; return((DocumentNode)null); } styleElement = viewModel.GetSceneNode((DocumentNode)documentCompositeNode1) as StyleNode; DependencyPropertyReferenceStep propertyReferenceStep = (DependencyPropertyReferenceStep)newElement.ViewModel.ProjectContext.ResolveProperty(ControlElement.TemplateProperty); if (documentCompositeNode1 != null) { DocumentCompositeNode documentCompositeNode2 = documentCompositeNode1.Properties[StyleNode.SettersProperty] as DocumentCompositeNode; if (documentCompositeNode2 != null) { foreach (DocumentNode documentNode1 in (IEnumerable <DocumentNode>)documentCompositeNode2.Children) { DocumentCompositeNode documentCompositeNode3 = documentNode1 as DocumentCompositeNode; if (documentCompositeNode3 != null) { IMemberId memberId = (IMemberId)DocumentPrimitiveNode.GetValueAsMember(documentCompositeNode3.Properties[SetterSceneNode.PropertyProperty]); DocumentNode documentNode2 = documentCompositeNode3.Properties[SetterSceneNode.ValueProperty]; if (memberId != null && documentNode2 != null && propertyReferenceStep.Equals((object)memberId)) { return(documentNode2); } } } } } return((DocumentNode)null); }
private void CreateFieldElement(DataViewBuilderContext context, DataViewTemplateEntry templateEntry) { context.CurrentFieldNode = (DocumentCompositeNode)templateEntry.FieldNode.Clone(context.DocumentContext); DocumentCompositeNode documentCompositeNode = (DocumentCompositeNode)context.CurrentFieldNode.Properties[(IPropertyId)templateEntry.FieldValueProperty]; string path = context.CurrentSchemaPath.Path; if (context.CurrentSchemaPath.Schema is XmlSchema) { string str = path ?? string.Empty; documentCompositeNode.Properties[BindingSceneNode.XPathProperty] = (DocumentNode)context.DocumentContext.CreateNode(str); } else if (!string.IsNullOrEmpty(path)) { object obj = this.Platform.Metadata.MakePropertyPath(path); documentCompositeNode.Properties[BindingSceneNode.PathProperty] = context.DocumentContext.CreateNode(obj.GetType(), obj); } BindingModeInfo defaultBindingMode = BindingPropertyHelper.GetDefaultBindingMode((DocumentNode)templateEntry.FieldNode, (IPropertyId)templateEntry.FieldValueProperty, context.CurrentSchemaPath); if (defaultBindingMode.IsOptional) { return; } DocumentPrimitiveNode node = context.DocumentContext.CreateNode(PlatformTypes.BindingMode, (IDocumentNodeValue) new DocumentNodeStringValue(defaultBindingMode.Mode.ToString())); documentCompositeNode.Properties[BindingSceneNode.ModeProperty] = (DocumentNode)node; }
public static string GetUserFriendlyDescription(DocumentCompositeNode expressionNode, DocumentNode parentNode) { if (DocumentNodeUtilities.IsDynamicResource((DocumentNode)expressionNode) || DocumentNodeUtilities.IsStaticResource((DocumentNode)expressionNode)) { DocumentNode resourceKey = ResourceNodeHelper.GetResourceKey(expressionNode); DocumentPrimitiveNode documentPrimitiveNode = resourceKey as DocumentPrimitiveNode; DocumentCompositeNode expressionNode1 = resourceKey as DocumentCompositeNode; if (documentPrimitiveNode != null && documentPrimitiveNode.Value != null) { return(documentPrimitiveNode.Value.ToString()); } if (expressionNode1 != null && DocumentNodeUtilities.IsMarkupExtension((DocumentNode)expressionNode1)) { return(XamlExpressionSerializer.GetUserFriendlyDescription(expressionNode1, (DocumentNode)expressionNode)); } } else if (DocumentNodeUtilities.IsStaticResource((DocumentNode)expressionNode)) { DocumentPrimitiveNode documentPrimitiveNode = expressionNode.Properties[StaticExtensionProperties.MemberProperty] as DocumentPrimitiveNode; if (documentPrimitiveNode != null) { return(documentPrimitiveNode.Value.ToString()); } } return(XamlExpressionSerializer.GetStringFromExpression((DocumentNode)expressionNode, parentNode)); }
private static RawDataSourceInfoBase GetDataSourceInfoFromResourceReference(DocumentCompositeNode resourceReferenceNode) { if (resourceReferenceNode.DocumentRoot == null) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } DocumentNode resourceKey = ResourceNodeHelper.GetResourceKey(resourceReferenceNode); ResourceReferenceType resourceType = ResourceNodeHelper.GetResourceType((DocumentNode)resourceReferenceNode); DocumentNodePath nodePath = new DocumentNodePath(resourceReferenceNode.DocumentRoot.RootNode, (DocumentNode)resourceReferenceNode); DocumentNode sourceNode = new ExpressionEvaluator((IDocumentRootResolver)resourceReferenceNode.Context).EvaluateResource(nodePath, resourceType, resourceKey); RawDataSourceInfoBase dataSourceInfoBase = (RawDataSourceInfoBase) new RawDataSourceInfo(sourceNode, (string)null); if (sourceNode != null && PlatformTypes.XmlDataProvider.IsAssignableFrom((ITypeId)sourceNode.Type)) { DocumentNode node = ((DocumentCompositeNode)sourceNode).Properties[XmlDataProviderSceneNode.XPathProperty]; if (node != null) { string valueAsString = DocumentPrimitiveNode.GetValueAsString(node); if (!string.IsNullOrEmpty(valueAsString)) { dataSourceInfoBase.XmlPath = valueAsString; } } } return(dataSourceInfoBase); }
public static string SerializeDoubleCollectionAsAttribute(DocumentCompositeNode compositeNode) { string str; StringBuilder stringBuilder = new StringBuilder(); using (IEnumerator <DocumentNode> enumerator = compositeNode.Children.GetEnumerator()) { while (enumerator.MoveNext()) { DocumentPrimitiveNode current = enumerator.Current as DocumentPrimitiveNode; if (current != null) { double value = current.GetValue <double>(); if (stringBuilder.Length > 0) { stringBuilder.Append(' '); } CultureInfo invariantCulture = CultureInfo.InvariantCulture; object[] objArray = new object[] { value }; stringBuilder.AppendFormat(invariantCulture, "{0:G8}", objArray); } else { str = null; return(str); } } return(stringBuilder.ToString()); } return(str); }
private void UpdateElementNameBindingsInternal(DocumentCompositeNode documentNode, IProperty elementNameProperty, string oldName, string newName) { DocumentNode node = documentNode.Properties[(IPropertyId)elementNameProperty]; if (node != null) { string valueAsString = DocumentPrimitiveNode.GetValueAsString(node); if (oldName == valueAsString) { documentNode.Properties[(IPropertyId)elementNameProperty] = (DocumentNode)documentNode.Context.CreateNode(newName); } } foreach (KeyValuePair <IProperty, DocumentNode> keyValuePair in (IEnumerable <KeyValuePair <IProperty, DocumentNode> >)documentNode.Properties) { DocumentCompositeNode documentNode1 = keyValuePair.Value as DocumentCompositeNode; if (documentNode1 != null && documentNode1.NameScope == null) { this.UpdateElementNameBindingsInternal(documentNode1, elementNameProperty, oldName, newName); } } if (!documentNode.SupportsChildren) { return; } for (int index = 0; index < documentNode.Children.Count; ++index) { DocumentCompositeNode documentNode1 = documentNode.Children[index] as DocumentCompositeNode; if (documentNode1 != null && documentNode1.NameScope == null) { this.UpdateElementNameBindingsInternal(documentNode1, elementNameProperty, oldName, newName); } } }
public static DocumentCompositeNode NewTemplateBindingNode(DocumentNode targetNode, IPropertyId sourceProperty, PropertyReference targetProperty) { DocumentCompositeNode documentCompositeNode = null; IDocumentContext context = targetNode.Context; if (!DocumentNodeUtilities.ShouldUseRelativeSourceTemplateBinding(targetNode, targetProperty)) { IProperty property = targetNode.TypeResolver.ResolveProperty(sourceProperty); DocumentNode documentNode = targetNode.Context.CreateNode(PlatformTypes.DependencyProperty, new DocumentNodeMemberValue(property)); documentCompositeNode = targetNode.Context.CreateNode(PlatformTypes.TemplateBinding); documentCompositeNode.Properties[KnownProperties.TemplateBindingPropertyProperty] = documentNode; } else { DocumentCompositeNode documentCompositeNode1 = targetNode.Context.CreateNode(PlatformTypes.RelativeSource); DocumentPrimitiveNode documentPrimitiveNode = targetNode.Context.CreateNode(PlatformTypes.RelativeSourceMode, new DocumentNodeStringValue("TemplatedParent")); documentCompositeNode1.Properties[KnownProperties.RelativeSourceModeProperty] = documentPrimitiveNode; IPlatformTypes platformMetadata = (IPlatformTypes)targetNode.PlatformMetadata; object obj = platformMetadata.MakePropertyPath(sourceProperty.Name, new object[0]); DocumentNode documentNode1 = targetNode.Context.CreateNode(obj.GetType(), obj); documentCompositeNode = targetNode.Context.CreateNode(PlatformTypes.Binding); documentCompositeNode.Properties[KnownProperties.BindingRelativeSourceProperty] = documentCompositeNode1; documentCompositeNode.Properties[KnownProperties.BindingPathProperty] = documentNode1; } return(documentCompositeNode); }
private void UpdatePropertyValues(DocumentCompositeNode compositeNode, SamplePropertyTypeOrFormatChanged change) { if (compositeNode == null) { return; } SampleProperty sampleProperty = change.SampleProperty; if (compositeNode.Type == sampleProperty.DeclaringSampleType) { if (change.OldType == SampleBasicType.Image) { DocumentPrimitiveNode documentPrimitiveNode = compositeNode.Properties[(IPropertyId)sampleProperty] as DocumentPrimitiveNode; if (documentPrimitiveNode != null) { string relativePath = documentPrimitiveNode.GetValue <string>(); sampleProperty.DeclaringDataSet.UnuseAssetFile(relativePath); } } this.CreatePropertyValue(compositeNode, sampleProperty); ++this.changeCount; } for (int index = 0; index < compositeNode.Properties.Count; ++index) { this.UpdatePropertyValues(compositeNode.Properties[index] as DocumentCompositeNode, change); } if (!compositeNode.SupportsChildren) { return; } for (int index = 0; index < compositeNode.Children.Count; ++index) { this.UpdatePropertyValues(compositeNode.Children[index] as DocumentCompositeNode, change); } }
private void ValidateRootXPath() { DocumentNode node = ((DocumentCompositeNode)this.DataSource.DocumentNode).Properties[XmlDataProviderSceneNode.XPathProperty]; if (node == null) { return; } string valueAsString = DocumentPrimitiveNode.GetValueAsString(node); if (string.IsNullOrEmpty(valueAsString)) { return; } DataSchemaNode dataSchemaNode = (DataSchemaNode)null; if ((int)valueAsString[0] == 47) { dataSchemaNode = this.GetNodeFromPath(valueAsString); } if (dataSchemaNode != null) { return; } this.invalidRootXPath = true; }
public void Execute() { if (!this.IsEnabled) { return; } ResourceEntryItem resourceEntryItem = (ResourceEntryItem)this.resourceManager.SelectedItems.Selection[0]; SceneNode sceneNode = resourceEntryItem.Container.ViewModel.GetSceneNode(resourceEntryItem.Resource.ValueNode); ConvertibleDrawing convertibleDrawing = ConvertibleDrawing.CreateConvertibleDrawing((object)(Brush)this.designerContext.ActiveSceneViewModel.CreateInstance(sceneNode.DocumentNodePath), sceneNode.ProjectContext.ProjectPath); if (convertibleDrawing == null) { return; } DocumentCompositeNode documentCompositeNode = (DocumentCompositeNode)sceneNode.DocumentNode; string valueAsString = DocumentPrimitiveNode.GetValueAsString(resourceEntryItem.Resource.KeyNode); string documentUrl = documentCompositeNode.DocumentRoot.DocumentContext.DocumentUrl; SceneViewModel activeSceneViewModel = this.designerContext.ActiveSceneViewModel; using (SceneEditTransaction editTransaction = activeSceneViewModel.CreateEditTransaction(this.CommandName)) { BaseFrameworkElement child = (BaseFrameworkElement)activeSceneViewModel.CreateSceneNode((object)convertibleDrawing.Convert()); activeSceneViewModel.ActiveSceneInsertionPoint.Insert((SceneNode)child); child.SetLocalValue(DesignTimeProperties.BrushDocumentReferenceProperty, (object)documentUrl); child.SetLocalValue(DesignTimeProperties.BrushKeyProperty, (object)valueAsString); child.Name = valueAsString + "_1"; this.point *= ElementUtilities.GetInverseMatrix(activeSceneViewModel.DefaultView.GetComputedTransformToRoot(activeSceneViewModel.ActiveSceneInsertionPoint.SceneElement)); Rect rect = new Rect(this.point, new Size(child.Width, child.Height)); activeSceneViewModel.GetLayoutDesignerForChild((SceneElement)child, true).SetChildRect(child, rect, LayoutOverrides.None, LayoutOverrides.Width | LayoutOverrides.Height, LayoutOverrides.None); this.designerContext.SelectionManager.ElementSelectionSet.SetSelection((SceneElement)child); editTransaction.Commit(); } }
public static IType GetStyleType(DocumentCompositeNode valueNode) { DocumentPrimitiveNode documentPrimitiveNode = valueNode.Properties[StyleNode.TargetTypeProperty] as DocumentPrimitiveNode; if (documentPrimitiveNode != null) { return(DocumentPrimitiveNode.GetValueAsType((DocumentNode)documentPrimitiveNode)); } return((IType)null); }
internal bool IsStyleControlParts(StyleAsset styleAsset) { DocumentPrimitiveNode documentPrimitiveNode = ((DocumentCompositeNode)styleAsset.ResourceModel.ValueNode).Properties[DesignTimeProperties.IsControlPartProperty] as DocumentPrimitiveNode; if (documentPrimitiveNode != null) { return(documentPrimitiveNode.GetValue <bool>()); } return(false); }
private T GetPrimitiveProperty <T>(DocumentCompositeNode docNode, IPropertyId property, T defaultValue) { DocumentPrimitiveNode documentPrimitiveNode = docNode.Properties[property] as DocumentPrimitiveNode; if (documentPrimitiveNode == null) { return(defaultValue); } return(documentPrimitiveNode.GetValue <T>()); }
protected string GetReferentialPropertyValue(DocumentCompositeNode compositeNode) { string str = (string)null; DocumentNode valueAsDocumentNode = this.GetReferentialPropertyValueAsDocumentNode(compositeNode); if (valueAsDocumentNode != null) { str = DocumentPrimitiveNode.GetValueAsString(valueAsDocumentNode); } return(str); }
public static string GetBindingPath(DocumentCompositeNode bindingNode) { string str = (string)null; DocumentCompositeNode documentCompositeNode = bindingNode.Properties[BindingSceneNode.PathProperty] as DocumentCompositeNode; if (documentCompositeNode != null) { str = DocumentPrimitiveNode.GetValueAsString(documentCompositeNode.Properties[documentCompositeNode.TypeResolver.PlatformMetadata.KnownProperties.PropertyPathPath]); } return(str); }
protected override void HandleDataContextPathExtension(DataBindingProcessingContext context, RawDataSourceInfoBase bindingInfo) { string valueAsString = DocumentPrimitiveNode.GetValueAsString(context.DocumentNode); PathChangeInfo pathChange = this.GetPathChange(bindingInfo, valueAsString, false); if (pathChange == null) { return; } this.pathChanges.Add((PathChange) new SampleDataDocumentChangeProcessor.PrimitivePathChange(pathChange, context.ParentNode, context.Property)); }
public static IType GetDataTemplateType(DocumentCompositeNode dataTemplateNode) { IType type = (IType)null; IProperty property = dataTemplateNode.TypeResolver.ResolveProperty(DataTemplateElement.DataTypeProperty); if (property != null) { type = DocumentPrimitiveNode.GetValueAsType(dataTemplateNode.Properties[(IPropertyId)property]); } return(type); }
protected void InitializeCurrentValueConverter() { if (this.TargetProperty == null) { return; } BindingSceneNode binding = this.TargetElement.GetBinding((IPropertyId)this.TargetProperty); if (binding == null) { return; } string str = binding.ConverterParameter as string; if (str != null) { this.ValueConverterParameter = str; } DocumentCompositeNode node = binding.Converter as DocumentCompositeNode; if (node == null) { return; } ValueConverterModel valueConverterModel = (ValueConverterModel)null; if (node.Type.IsResource) { string key = DocumentPrimitiveNode.GetValueAsString(ResourceNodeHelper.GetResourceKey(node)); if (string.IsNullOrEmpty(key)) { return; } valueConverterModel = Enumerable.FirstOrDefault <ValueConverterModel>((IEnumerable <ValueConverterModel>) this.ValueConverters, (Func <ValueConverterModel, bool>)(vc => vc.DisplayName == key)); } else { SceneNode sceneNode = this.ViewModel.GetSceneNode((DocumentNode)node); if (sceneNode != null) { valueConverterModel = ValueConverterModelFactory.CreateValueConverterModel(sceneNode); if (valueConverterModel != null) { this.ValueConverters.Add(valueConverterModel); } } } if (valueConverterModel == null) { return; } this.CurrentValueConverter = valueConverterModel; }
private void SetExistingBindingValues(BindingSceneNode existingBinding) { string path = existingBinding.PathOrXPath; DocumentNode node1 = (DocumentNode)null; DocumentCompositeNode node2 = existingBinding.SupportsSource ? existingBinding.Source as DocumentCompositeNode : (DocumentCompositeNode)null; if (node2 != null && node2.Type.IsResource) { node1 = ResourceNodeHelper.GetResourceKey(node2); } if (node1 != null) { this.InitializeDataSource(DocumentPrimitiveNode.GetValueAsString(node1), path); } else if (existingBinding.SupportsElementName && existingBinding.ElementName != null && this.elementPropertyModel != null) { this.InitializeElementName(existingBinding.ElementName, path); } else { this.InitializeExplicitDataContext(path); } if (this.bindingSourcesProxy.Value.Path != path) { if (this.CurrentBindingSource.Schema is EmptySchema && existingBinding.SupportsXPath && !string.IsNullOrEmpty(existingBinding.XPath)) { path = "XPath=" + path; } this.CustomBindingExpression = path; this.UseCustomBindingExpression = true; } DocumentNode node3 = existingBinding.SupportsFallbackValue ? existingBinding.FallbackValue : (DocumentNode)null; if (node3 != null) { string valueAsString = DocumentPrimitiveNode.GetValueAsString(node3); if (valueAsString != null) { this.BindingFallbackValue = valueAsString; } } if (existingBinding.IsModeSet) { this.CurrentBindingMode = existingBinding.Mode; } if (!existingBinding.SupportsUpdateSourceTrigger) { return; } this.CurrentUpdateSourceTrigger = existingBinding.UpdateSourceTrigger; }
public static IType GetDataType(DocumentNode dataNode) { if (dataNode == null) { return((IType)null); } IType type1 = dataNode.Type; IType type2; if (dataNode is DocumentPrimitiveNode) { type2 = DocumentPrimitiveNode.GetValueAsType(dataNode) ?? dataNode.Type; } else { DocumentCompositeNode documentCompositeNode = (DocumentCompositeNode)dataNode; if (PlatformTypes.ObjectDataProvider.IsAssignableFrom((ITypeId)dataNode.Type)) { type2 = DataContextHelper.GetObjectDataProviderType(documentCompositeNode); } else if (PlatformTypes.CollectionViewSource.IsAssignableFrom((ITypeId)dataNode.Type)) { type2 = DataContextHelper.GetCollectionViewSourceType(documentCompositeNode); } else if (dataNode.Type.IsBinding) { type2 = DataContextHelper.GetBindingType(documentCompositeNode); } else if (dataNode.Type.RuntimeType == typeof(DesignInstanceExtension)) { type2 = DataContextHelper.GetDesignInstanceType(documentCompositeNode); } else if (dataNode.Type.RuntimeType == typeof(DesignDataExtension)) { type2 = DataContextHelper.GetDesignDataType(documentCompositeNode); } else { if (!PlatformTypes.DataTemplate.IsAssignableFrom((ITypeId)dataNode.Type)) { return(dataNode.Type); } type2 = DataContextHelper.GetDataTemplateType(documentCompositeNode); } if (type2 == null || type2.RuntimeType == (Type)null) { type2 = dataNode.TypeResolver.ResolveType(PlatformTypes.Object); } } return(type2); }
internal static string TargetNameFromDocumentNode(DocumentCompositeNode node) { DocumentCompositeNode node1 = node.Properties[BeginActionNode.StoryboardProperty] as DocumentCompositeNode; if (node1 != null && node1.Type.IsResource) { DocumentNode resourceKey = ResourceNodeHelper.GetResourceKey(node1); if (resourceKey != null) { return(DocumentPrimitiveNode.GetValueAsString(resourceKey)); } } return((string)null); }
private bool IsExplicitAnimationProperty(DocumentNode node) { DocumentPrimitiveNode documentPrimitiveNode = node as DocumentPrimitiveNode; if (documentPrimitiveNode != null && documentPrimitiveNode.Type.Equals(PlatformTypes.DependencyProperty)) { IMember valueAsMember = DocumentPrimitiveNode.GetValueAsMember(documentPrimitiveNode); IProperty property = node.TypeResolver.ResolveProperty(DesignTimeProperties.ExplicitAnimationProperty); if (valueAsMember != null && valueAsMember.DeclaringType.FullName == property.DeclaringType.FullName && valueAsMember.Name == DesignTimeProperties.ExplicitAnimationPropertyName) { return(true); } } return(false); }
private static bool GetPolySegmentAsString(DocumentCompositeNode polySegmentNode, StringBuilder stringBuilder, char symbol, IPropertyId pointsProperty) { DocumentPrimitiveNode item = polySegmentNode.Properties[pointsProperty] as DocumentPrimitiveNode; if (item == null) { return(false); } PointCollection value = item.GetValue <PointCollection>(); stringBuilder.Append(' '); stringBuilder.Append(symbol); stringBuilder.Append(PointSerializationHelper.GetPointCollectionAsString(value)); return(true); }
public static string GetBindingXPath(DocumentCompositeNode bindingNode) { string str = (string)null; IProperty property = bindingNode.TypeResolver.ResolveProperty(BindingSceneNode.XPathProperty); if (property != null) { DocumentPrimitiveNode documentPrimitiveNode = bindingNode.Properties[(IPropertyId)property] as DocumentPrimitiveNode; if (documentPrimitiveNode != null) { str = DocumentPrimitiveNode.GetValueAsString((DocumentNode)documentPrimitiveNode); } } return(str); }
private string GetID(DocumentCompositeNode compositeNode) { string str; if (this.IsRootNode((DocumentNode)compositeNode)) { str = "~Self"; } else { IPropertyId index = (IPropertyId)compositeNode.Type.Metadata.NameProperty; str = DocumentPrimitiveNode.GetValueAsString(compositeNode.Properties[index]); } return(str); }