Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Model / FakeModelItemImpl.cs / 1305376 / FakeModelItemImpl.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Presentation.Model { ////// FakeModelItemImpl - purpose of this class is to allow full model editing expirience, without need to participate within model tree operations /// If you use this class, even though it contains reference to ModelTreeManager, you are not affecting actual model tree. Any changes made to the /// model, do not result in any undo/redo operations /// see aslo DesignObjectWrapper class for more usage details /// sealed class FakeModelItemImpl : ModelItemImpl { public FakeModelItemImpl(ModelTreeManager modelTreeManager, Type itemType, object instance, FakeModelItemImpl parent) : base(modelTreeManager, itemType, instance, parent) { } public override ModelItem Root { get { if (this.Parent == null) { return this; } else { return this.Parent.Root; } } } protected override void OnPropertyChanged(string propertyName) { IModelTreeItem modelTreeItem = (IModelTreeItem)this; ModelItem currentValue; //if property value has changed - remove existing value, so the ModelPropertyImplementation will //force reading the value from the underlying object if (modelTreeItem.ModelPropertyStore.TryGetValue(propertyName, out currentValue)) { IModelTreeItem valueAsTreeItem = (IModelTreeItem)currentValue; //cleanup references valueAsTreeItem.RemoveParent(this); valueAsTreeItem.RemoveSource(this.Properties[propertyName]); //remove from store modelTreeItem.ModelPropertyStore.Remove(propertyName); } base.OnPropertyChanged(propertyName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Presentation.Model { ////// FakeModelItemImpl - purpose of this class is to allow full model editing expirience, without need to participate within model tree operations /// If you use this class, even though it contains reference to ModelTreeManager, you are not affecting actual model tree. Any changes made to the /// model, do not result in any undo/redo operations /// see aslo DesignObjectWrapper class for more usage details /// sealed class FakeModelItemImpl : ModelItemImpl { public FakeModelItemImpl(ModelTreeManager modelTreeManager, Type itemType, object instance, FakeModelItemImpl parent) : base(modelTreeManager, itemType, instance, parent) { } public override ModelItem Root { get { if (this.Parent == null) { return this; } else { return this.Parent.Root; } } } protected override void OnPropertyChanged(string propertyName) { IModelTreeItem modelTreeItem = (IModelTreeItem)this; ModelItem currentValue; //if property value has changed - remove existing value, so the ModelPropertyImplementation will //force reading the value from the underlying object if (modelTreeItem.ModelPropertyStore.TryGetValue(propertyName, out currentValue)) { IModelTreeItem valueAsTreeItem = (IModelTreeItem)currentValue; //cleanup references valueAsTreeItem.RemoveParent(this); valueAsTreeItem.RemoveSource(this.Properties[propertyName]); //remove from store modelTreeItem.ModelPropertyStore.Remove(propertyName); } base.OnPropertyChanged(propertyName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StrongName.cs
- DataFieldConverter.cs
- HttpHandlersSection.cs
- HtmlControlPersistable.cs
- DateTimeStorage.cs
- TypeLibConverter.cs
- LocationReference.cs
- ListSortDescriptionCollection.cs
- ResourceReferenceExpression.cs
- Scalars.cs
- TextDecorationCollection.cs
- SqlConnectionStringBuilder.cs
- entityreference_tresulttype.cs
- DesignBindingEditor.cs
- CredentialCache.cs
- DesignerActionMethodItem.cs
- EditableRegion.cs
- InsufficientMemoryException.cs
- SelectionItemPattern.cs
- PartManifestEntry.cs
- RelatedCurrencyManager.cs
- EntityDesignerUtils.cs
- LocatorBase.cs
- RepeaterItemEventArgs.cs
- TextCharacters.cs
- DispatcherSynchronizationContext.cs
- MetafileHeader.cs
- ConstNode.cs
- XmlNodeChangedEventManager.cs
- ExceptQueryOperator.cs
- KnownBoxes.cs
- Signature.cs
- UnionExpr.cs
- MappingException.cs
- VisualStateGroup.cs
- RenderOptions.cs
- SimpleTypeResolver.cs
- DecoderNLS.cs
- ReplyChannelBinder.cs
- InputScopeManager.cs
- TextEditorParagraphs.cs
- XmlDictionaryWriter.cs
- SymDocumentType.cs
- UpdateEventArgs.cs
- XmlUtil.cs
- NumericUpDown.cs
- SystemSounds.cs
- ErrorTableItemStyle.cs
- ProtocolsConfigurationEntry.cs
- ColorConvertedBitmap.cs
- CustomErrorsSection.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- Html32TextWriter.cs
- DaylightTime.cs
- CategoryGridEntry.cs
- TableTextElementCollectionInternal.cs
- DataGridViewRow.cs
- InfoCardMasterKey.cs
- Internal.cs
- UpdateExpressionVisitor.cs
- DoubleAnimationClockResource.cs
- FormCollection.cs
- OdbcFactory.cs
- RadioButtonRenderer.cs
- Double.cs
- SmiRequestExecutor.cs
- RoutedEventHandlerInfo.cs
- ColorMap.cs
- SmtpClient.cs
- FigureHelper.cs
- FrameSecurityDescriptor.cs
- ComMethodElement.cs
- Light.cs
- AdobeCFFWrapper.cs
- HttpValueCollection.cs
- StylusLogic.cs
- PasswordPropertyTextAttribute.cs
- WindowsFormsLinkLabel.cs
- QueryHandler.cs
- FloaterParaClient.cs
- EnumerableRowCollectionExtensions.cs
- XmlSchemaSet.cs
- DbModificationCommandTree.cs
- SqlAggregateChecker.cs
- AudioException.cs
- ControlValuePropertyAttribute.cs
- DataGridViewLinkColumn.cs
- GridViewColumnHeader.cs
- UrlMapping.cs
- RequestReplyCorrelator.cs
- RelationshipNavigation.cs
- RequestNavigateEventArgs.cs
- RichTextBox.cs
- HttpCapabilitiesBase.cs
- DateTimeConstantAttribute.cs
- ObjectCloneHelper.cs
- HtmlSelect.cs
- VerificationAttribute.cs
- HMACSHA512.cs
- Command.cs