public ResourceValueModel(ResourceEntryItem resourceItem, DesignerContext designerContext) { this.resourceItem = resourceItem; this.helper = new PropertyEditingHelper(this.resourceItem.Container.Document, (UIElement)null); this.objectSet = new ResourceValueObjectSet(resourceItem, designerContext, (IPropertyInspector)this); this.valueProperty = this.objectSet.CreateSceneNodeProperty(new PropertyReference((ReferenceStep)resourceItem.Container.ProjectContext.ResolveProperty(DictionaryEntryNode.ValueProperty)), TypeUtilities.GetAttributes(resourceItem.Resource.TargetType)); this.valueProperty.PropertyValue.PropertyValueException += new EventHandler <PropertyValueExceptionEventArgs>(this.OnPropertyValueException); }
public void OnRemoved() { this.valueProperty.OnRemoveFromCategory(); if (this.objectSet != null) { this.objectSet.Dispose(); this.objectSet = (ResourceValueObjectSet)null; } if (this.helper.ActiveDocument.IsEditable) { return; } this.helper.CancelOutstandingTransactions(); }
public EditResourceModel(DesignerContext designerContext, DictionaryEntryNode resourceEntryNode, IPropertyInspector transactionContext) { this.designerContext = designerContext; this.resourceEntryNode = resourceEntryNode; object key = resourceEntryNode.Key; DocumentNode expression; if ((expression = key as DocumentNode) != null) { this.keyString = XamlExpressionSerializer.GetStringFromExpression(expression, resourceEntryNode.DocumentNode); } else if ((this.keyString = key as string) == null) { this.keyString = key.ToString(); } this.keyStringIsValid = true; ResourceEntryItem resource = (ResourceEntryItem)this.designerContext.ResourceManager.GetResourceItem((DocumentCompositeNode)resourceEntryNode.DocumentNode); this.resourceObjectSet = new ResourceValueObjectSet(resource, designerContext, transactionContext); this.standInProperty = this.resourceObjectSet.CreateProperty(new PropertyReference((ReferenceStep)this.resourceObjectSet.ProjectContext.ResolveProperty(DictionaryEntryNode.ValueProperty)), TypeUtilities.GetAttributes(resource.EffectiveType)); this.standInProperty.PropertyValue.PropertyValueException += new EventHandler <PropertyValueExceptionEventArgs>(this.OnPropertyValueException); this.standInProperty.PropertyValue.PropertyChanged += new PropertyChangedEventHandler(this.OnValuePropertyChanged); }