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
- AdornerPresentationContext.cs
- WindowsScrollBarBits.cs
- FeatureAttribute.cs
- QilPatternVisitor.cs
- ParentControlDesigner.cs
- IdentityModelDictionary.cs
- WebPartCatalogAddVerb.cs
- DesignerTransactionCloseEvent.cs
- KernelTypeValidation.cs
- _OverlappedAsyncResult.cs
- RefExpr.cs
- ISFClipboardData.cs
- Accessible.cs
- ErrorHandler.cs
- ByteKeyFrameCollection.cs
- ToolBarButtonClickEvent.cs
- IgnoreSectionHandler.cs
- StringFormat.cs
- CollectionContainer.cs
- TemplateBamlTreeBuilder.cs
- Timer.cs
- webeventbuffer.cs
- XamlSerializationHelper.cs
- FixedSOMImage.cs
- ChainOfResponsibility.cs
- ControlBindingsConverter.cs
- ExecutedRoutedEventArgs.cs
- DebuggerAttributes.cs
- ThreadAbortException.cs
- HwndHost.cs
- FormViewPagerRow.cs
- TypeForwardedToAttribute.cs
- GridViewUpdateEventArgs.cs
- WebPartZoneCollection.cs
- FilteredSchemaElementLookUpTable.cs
- ConfigsHelper.cs
- ContextStack.cs
- DataGridCaption.cs
- TableSectionStyle.cs
- FilterEventArgs.cs
- Label.cs
- AttributeCollection.cs
- AuthenticationModuleElementCollection.cs
- UserControlBuildProvider.cs
- OutputCacheModule.cs
- DynamicMethod.cs
- safex509handles.cs
- XmlElementList.cs
- ReceiveMessageRecord.cs
- SHA384.cs
- SpellerHighlightLayer.cs
- DoubleSumAggregationOperator.cs
- FontCacheUtil.cs
- latinshape.cs
- ImageSource.cs
- HtmlMeta.cs
- DragAssistanceManager.cs
- ObjectRef.cs
- SerializableTypeCodeDomSerializer.cs
- ServiceDocumentFormatter.cs
- ExpandedWrapper.cs
- AccessDataSource.cs
- TypedTableBaseExtensions.cs
- EntityDataSourceEntityTypeFilterItem.cs
- DisableDpiAwarenessAttribute.cs
- Int32AnimationBase.cs
- SiteMapProvider.cs
- ExtendedTransformFactory.cs
- MemberDomainMap.cs
- WorkflowClientDeliverMessageWrapper.cs
- MouseDevice.cs
- ProviderConnectionPoint.cs
- AsyncOperationManager.cs
- TextViewBase.cs
- WindowsEditBoxRange.cs
- Native.cs
- InputMethodStateChangeEventArgs.cs
- InstancePersistenceCommandException.cs
- ObjectContextServiceProvider.cs
- ControlCollection.cs
- TextFormatter.cs
- TextContainerChangeEventArgs.cs
- LineGeometry.cs
- TraceRecord.cs
- EncoderFallback.cs
- WebBaseEventKeyComparer.cs
- RemoveStoryboard.cs
- WindowsProgressbar.cs
- ListItem.cs
- XmlBinaryReader.cs
- AdornerPresentationContext.cs
- DbProviderConfigurationHandler.cs
- BindingOperations.cs
- LinkButton.cs
- ParameterRetriever.cs
- X509Utils.cs
- XmlNamespaceManager.cs
- UserControlBuildProvider.cs
- WebHeaderCollection.cs
- RequestCachingSection.cs