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
- SecurityTokenSerializer.cs
- Grant.cs
- ThreadSafeList.cs
- MessagingDescriptionAttribute.cs
- ListViewItem.cs
- ServiceDescription.cs
- EventLogPermissionEntryCollection.cs
- CellLabel.cs
- URI.cs
- IsolatedStorageFilePermission.cs
- GraphicsPath.cs
- FixedDocumentSequencePaginator.cs
- SQLInt16.cs
- RectangleGeometry.cs
- OutputCacheSettingsSection.cs
- FlowDocument.cs
- Rectangle.cs
- DrawItemEvent.cs
- ActivityCodeDomReferenceService.cs
- GorillaCodec.cs
- MethodBuilder.cs
- AnimationClock.cs
- COM2PropertyBuilderUITypeEditor.cs
- TagPrefixCollection.cs
- ByteStream.cs
- DBSchemaRow.cs
- TraversalRequest.cs
- LicenseManager.cs
- CodeVariableDeclarationStatement.cs
- InvalidWorkflowException.cs
- RegexReplacement.cs
- MethodImplAttribute.cs
- TextBox.cs
- StaticTextPointer.cs
- Sequence.cs
- Scheduler.cs
- EdmConstants.cs
- EntityReference.cs
- ContentDesigner.cs
- HtmlTextArea.cs
- TypePropertyEditor.cs
- XmlSignatureManifest.cs
- ECDsaCng.cs
- Argument.cs
- UITypeEditors.cs
- XmlSerializerSection.cs
- XmlCharacterData.cs
- _ContextAwareResult.cs
- TextOptionsInternal.cs
- PersonalizationEntry.cs
- DataGridViewCellStyle.cs
- XamlPathDataSerializer.cs
- FileLogRecordStream.cs
- Matrix.cs
- GridViewActionList.cs
- EditCommandColumn.cs
- PackageRelationshipSelector.cs
- ValidatingPropertiesEventArgs.cs
- WindowsScroll.cs
- AgileSafeNativeMemoryHandle.cs
- MessageBox.cs
- StylusPointPropertyInfo.cs
- UiaCoreProviderApi.cs
- Nodes.cs
- SystemIPv4InterfaceProperties.cs
- WindowsRichEdit.cs
- DocumentViewerBaseAutomationPeer.cs
- UIElement3DAutomationPeer.cs
- EventSource.cs
- Mappings.cs
- WindowsStatic.cs
- PopupRoot.cs
- ProcessModelSection.cs
- ModelChangedEventArgsImpl.cs
- CodeThrowExceptionStatement.cs
- UidManager.cs
- PolyLineSegmentFigureLogic.cs
- SubqueryTrackingVisitor.cs
- ResourceWriter.cs
- FaultDesigner.cs
- Odbc32.cs
- StreamGeometry.cs
- SystemIcmpV6Statistics.cs
- InvalidAsynchronousStateException.cs
- TypographyProperties.cs
- CustomGrammar.cs
- ClassicBorderDecorator.cs
- DataBindingCollection.cs
- ConfigurationProperty.cs
- GeneralTransform3DTo2D.cs
- RequestTimeoutManager.cs
- DataSourceControlBuilder.cs
- UncommonField.cs
- InfoCardAsymmetricCrypto.cs
- DataStorage.cs
- MulticastNotSupportedException.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- ConvertTextFrag.cs
- RelationHandler.cs
- BinaryObjectInfo.cs