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
- Vertex.cs
- LogWriteRestartAreaState.cs
- DeviceFiltersSection.cs
- SignatureToken.cs
- PropertyIdentifier.cs
- TextPattern.cs
- NativeRightsManagementAPIsStructures.cs
- SafeFileHandle.cs
- StringInfo.cs
- ProfessionalColors.cs
- SessionEndedEventArgs.cs
- Bits.cs
- DataGridViewTextBoxEditingControl.cs
- AuthenticatedStream.cs
- EventTrigger.cs
- Behavior.cs
- WebSysDisplayNameAttribute.cs
- WebHeaderCollection.cs
- DocumentViewerAutomationPeer.cs
- SynchronizingStream.cs
- TableLayoutRowStyleCollection.cs
- GiveFeedbackEventArgs.cs
- SocketInformation.cs
- StartUpEventArgs.cs
- _NegoStream.cs
- ImageIndexEditor.cs
- DispatcherTimer.cs
- Comparer.cs
- HtmlAnchor.cs
- RadioButtonFlatAdapter.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- ExtendedPropertyCollection.cs
- TransactionScope.cs
- AutomationFocusChangedEventArgs.cs
- DataColumn.cs
- ContainerActivationHelper.cs
- DataServiceConfiguration.cs
- _CommandStream.cs
- ToolStripAdornerWindowService.cs
- Pts.cs
- InvalidCastException.cs
- TaskHelper.cs
- SqlError.cs
- PersistenceTypeAttribute.cs
- FixedSOMTableRow.cs
- ViewValidator.cs
- AutomationEvent.cs
- PageHandlerFactory.cs
- TypeBuilder.cs
- HandlerFactoryWrapper.cs
- GridViewEditEventArgs.cs
- WsdlBuildProvider.cs
- GetImportFileNameRequest.cs
- SettingsPropertyIsReadOnlyException.cs
- HwndSourceKeyboardInputSite.cs
- OdbcCommand.cs
- UriSectionData.cs
- DataRecord.cs
- InstallerTypeAttribute.cs
- HuffmanTree.cs
- ForwardPositionQuery.cs
- KeyboardDevice.cs
- WindowAutomationPeer.cs
- SoapSchemaImporter.cs
- SecurityToken.cs
- SendKeys.cs
- IndentedTextWriter.cs
- TextEditorTyping.cs
- SQLCharsStorage.cs
- EnumDataContract.cs
- VariableQuery.cs
- EnumValAlphaComparer.cs
- ObjectViewQueryResultData.cs
- UriTemplateDispatchFormatter.cs
- CompleteWizardStep.cs
- WebEncodingValidator.cs
- RuntimeWrappedException.cs
- SkipStoryboardToFill.cs
- metadatamappinghashervisitor.cs
- MexHttpsBindingElement.cs
- DefaultHttpHandler.cs
- TemplatedEditableDesignerRegion.cs
- SHA1CryptoServiceProvider.cs
- ConfigPathUtility.cs
- Mapping.cs
- NavigationService.cs
- ListViewUpdateEventArgs.cs
- DbSourceCommand.cs
- ControlOperationInvoker.cs
- TextStore.cs
- TextPatternIdentifiers.cs
- TableRowCollection.cs
- ClientFormsAuthenticationCredentials.cs
- QuaternionConverter.cs
- BuildProvidersCompiler.cs
- CoordinationService.cs
- ImageButton.cs
- DataGridViewCellStyleConverter.cs
- HttpAsyncResult.cs
- XAMLParseException.cs