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
- storepermission.cs
- IsolatedStorageException.cs
- thaishape.cs
- DiffuseMaterial.cs
- UnionCodeGroup.cs
- DataGridViewImageColumn.cs
- DefaultBindingPropertyAttribute.cs
- TextSimpleMarkerProperties.cs
- MachinePropertyVariants.cs
- FlatButtonAppearance.cs
- PixelFormats.cs
- EtwTrace.cs
- ActivityStateRecord.cs
- CallSiteHelpers.cs
- ClassicBorderDecorator.cs
- NetworkCredential.cs
- ProtectedConfigurationProviderCollection.cs
- DesignerListAdapter.cs
- Tile.cs
- HashCryptoHandle.cs
- ResolveMatchesCD1.cs
- StructuredTypeInfo.cs
- AccessibleObject.cs
- TitleStyle.cs
- DataTableClearEvent.cs
- Int32Converter.cs
- Delay.cs
- XMLUtil.cs
- SecurityTokenProvider.cs
- TextEditorCharacters.cs
- ChtmlLinkAdapter.cs
- BeginEvent.cs
- DataGridComponentEditor.cs
- ComPersistableTypeElement.cs
- DbParameterCollectionHelper.cs
- TextDpi.cs
- CookieProtection.cs
- CharConverter.cs
- AppearanceEditorPart.cs
- LocalValueEnumerator.cs
- ServiceRoute.cs
- SByteConverter.cs
- AsyncWaitHandle.cs
- SimpleWebHandlerParser.cs
- WSSecureConversation.cs
- GCHandleCookieTable.cs
- XmlParserContext.cs
- ProcessModelInfo.cs
- NamespaceEmitter.cs
- RootProfilePropertySettingsCollection.cs
- ExpandedWrapper.cs
- ButtonAutomationPeer.cs
- DataBinding.cs
- DataBoundControl.cs
- FormViewCommandEventArgs.cs
- wgx_exports.cs
- WrappedIUnknown.cs
- RuntimeHelpers.cs
- StreamInfo.cs
- GeneralTransform3DGroup.cs
- ParserExtension.cs
- SerializerDescriptor.cs
- XsltException.cs
- IIS7UserPrincipal.cs
- SerializerProvider.cs
- CharacterMetrics.cs
- HttpFileCollectionBase.cs
- DescendentsWalker.cs
- DBNull.cs
- BamlVersionHeader.cs
- AliasedSlot.cs
- TreeNodeStyleCollection.cs
- ConfigurationStrings.cs
- Menu.cs
- SQLBinary.cs
- SqlParameter.cs
- RemotingServices.cs
- AutomationPattern.cs
- BuildManagerHost.cs
- SecurityCapabilities.cs
- SqlXmlStorage.cs
- Config.cs
- MaterializeFromAtom.cs
- CurrencyWrapper.cs
- MachineKeyConverter.cs
- DetailsViewUpdatedEventArgs.cs
- QueryStringParameter.cs
- HashRepartitionStream.cs
- EventSinkHelperWriter.cs
- DataGridViewCellCancelEventArgs.cs
- UniqueIdentifierService.cs
- EntityKey.cs
- WebService.cs
- SqlVersion.cs
- ControlPropertyNameConverter.cs
- AVElementHelper.cs
- RemoteWebConfigurationHost.cs
- ValidationUtility.cs
- BindableAttribute.cs
- XmlSchemaFacet.cs