Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / DataObjectEventArgs.cs / 1305600 / DataObjectEventArgs.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: Base class for DataObject events arguments // //--------------------------------------------------------------------------- using System; namespace System.Windows { ////// Base class for DataObject.Copying/Pasting events. /// These events are raised when an editor deals with /// a data object before putting it to clipboard on copy /// and before starting drag operation; /// or before Pasting its content into a selection /// on Paste/Drop operations. /// /// This class is abstract - it provides only common /// members for the events. Particular commands /// must use more specific event arguments - /// DataObjectCopyingEventArgs or DataObjectPastingEventArgs. /// public abstract class DataObjectEventArgs : RoutedEventArgs { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors ////// Creates a DataObjectCopyEvent. /// This object created by editors executing a Copy/Paste /// and Drag/Drop comands. /// /// /// An event id. One of: CopyingEvent or PastingEvent /// /// /// A flag indicating if this operation is part of drag/drop. /// Copying event fired on drag start, Pasting - on drop. /// Cancelling the command stops drag/drop process in /// an appropriate moment. /// internal DataObjectEventArgs(RoutedEvent routedEvent, bool isDragDrop) : base() { if (routedEvent != DataObject.CopyingEvent && routedEvent != DataObject.PastingEvent && routedEvent != DataObject.SettingDataEvent) { throw new ArgumentOutOfRangeException("routedEvent"); } RoutedEvent = routedEvent; _isDragDrop = isDragDrop; _commandCancelled = false; } #endregion Constructors //------------------------------------------------------ // // Public Properties // //----------------------------------------------------- #region Public Properties ////// A flag indicating if this operation is part of drag/drop. /// Copying event fired on drag start, Pasting - on drop. /// Cancelling the command stops drag/drop process in /// an appropriate moment. /// public bool IsDragDrop { get { return _isDragDrop; } } ////// A current cancellation status of the event. /// When set to true, copy command is going to be cancelled. /// public bool CommandCancelled { get { return _commandCancelled; } } #endregion Public Properties //------------------------------------------------------ // // Protected Methods // //------------------------------------------------------ #region Public Methods ////// Sets cancelled status of a command to true. /// After calling this method the command will be /// stopped from calling. /// Applied to Drag (event="Copying", isDragDrop="true") /// this would stop the whole dragdrop process. /// ////// After an event has been cancelled it's impossible /// to re-enable it. /// public void CancelCommand() { _commandCancelled = true; } #endregion Public Methods //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ #region Private Fields private bool _isDragDrop; private bool _commandCancelled; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: Base class for DataObject events arguments // //--------------------------------------------------------------------------- using System; namespace System.Windows { ////// Base class for DataObject.Copying/Pasting events. /// These events are raised when an editor deals with /// a data object before putting it to clipboard on copy /// and before starting drag operation; /// or before Pasting its content into a selection /// on Paste/Drop operations. /// /// This class is abstract - it provides only common /// members for the events. Particular commands /// must use more specific event arguments - /// DataObjectCopyingEventArgs or DataObjectPastingEventArgs. /// public abstract class DataObjectEventArgs : RoutedEventArgs { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors ////// Creates a DataObjectCopyEvent. /// This object created by editors executing a Copy/Paste /// and Drag/Drop comands. /// /// /// An event id. One of: CopyingEvent or PastingEvent /// /// /// A flag indicating if this operation is part of drag/drop. /// Copying event fired on drag start, Pasting - on drop. /// Cancelling the command stops drag/drop process in /// an appropriate moment. /// internal DataObjectEventArgs(RoutedEvent routedEvent, bool isDragDrop) : base() { if (routedEvent != DataObject.CopyingEvent && routedEvent != DataObject.PastingEvent && routedEvent != DataObject.SettingDataEvent) { throw new ArgumentOutOfRangeException("routedEvent"); } RoutedEvent = routedEvent; _isDragDrop = isDragDrop; _commandCancelled = false; } #endregion Constructors //------------------------------------------------------ // // Public Properties // //----------------------------------------------------- #region Public Properties ////// A flag indicating if this operation is part of drag/drop. /// Copying event fired on drag start, Pasting - on drop. /// Cancelling the command stops drag/drop process in /// an appropriate moment. /// public bool IsDragDrop { get { return _isDragDrop; } } ////// A current cancellation status of the event. /// When set to true, copy command is going to be cancelled. /// public bool CommandCancelled { get { return _commandCancelled; } } #endregion Public Properties //------------------------------------------------------ // // Protected Methods // //------------------------------------------------------ #region Public Methods ////// Sets cancelled status of a command to true. /// After calling this method the command will be /// stopped from calling. /// Applied to Drag (event="Copying", isDragDrop="true") /// this would stop the whole dragdrop process. /// ////// After an event has been cancelled it's impossible /// to re-enable it. /// public void CancelCommand() { _commandCancelled = true; } #endregion Public Methods //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ #region Private Fields private bool _isDragDrop; private bool _commandCancelled; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ToolTip.cs
- Timer.cs
- ToolStripItemEventArgs.cs
- CustomPopupPlacement.cs
- ObjectIDGenerator.cs
- SQLByte.cs
- VirtualDirectoryMappingCollection.cs
- TextBoxView.cs
- CharacterBuffer.cs
- BaseTransportHeaders.cs
- brushes.cs
- XmlKeywords.cs
- Content.cs
- UniqueConstraint.cs
- Wildcard.cs
- XDRSchema.cs
- SqlAliaser.cs
- NonValidatingSecurityTokenAuthenticator.cs
- PageThemeBuildProvider.cs
- CanonicalizationDriver.cs
- GestureRecognizer.cs
- QueryRewriter.cs
- BevelBitmapEffect.cs
- EmissiveMaterial.cs
- XmlSchemaIdentityConstraint.cs
- ObfuscateAssemblyAttribute.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- SelectionEditor.cs
- NotificationContext.cs
- FunctionDetailsReader.cs
- SplitterPanel.cs
- BufferAllocator.cs
- TreeNodeCollection.cs
- StreamResourceInfo.cs
- X509SubjectKeyIdentifierClause.cs
- SafeRightsManagementHandle.cs
- SignatureDescription.cs
- SerializationFieldInfo.cs
- LoginView.cs
- AssociationSetMetadata.cs
- XmlSchemaImporter.cs
- DataKey.cs
- LineServicesCallbacks.cs
- TextAutomationPeer.cs
- BoundsDrawingContextWalker.cs
- TextMetrics.cs
- GrammarBuilderDictation.cs
- DataSetUtil.cs
- ZipIOExtraFieldPaddingElement.cs
- ListViewGroupConverter.cs
- DBSqlParser.cs
- IPAddress.cs
- HttpCapabilitiesEvaluator.cs
- XmlSchemaAnnotation.cs
- ErrorHandler.cs
- IssuanceLicense.cs
- entitydatasourceentitysetnameconverter.cs
- TextProperties.cs
- EntityDataSourceMemberPath.cs
- CodeCommentStatement.cs
- RegexCode.cs
- InteropAutomationProvider.cs
- TrackingParameters.cs
- ViewKeyConstraint.cs
- Codec.cs
- ApplicationHost.cs
- TextPenaltyModule.cs
- SweepDirectionValidation.cs
- UInt32Storage.cs
- GeometryModel3D.cs
- BuildDependencySet.cs
- CustomCategoryAttribute.cs
- RedistVersionInfo.cs
- TreeNodeStyle.cs
- ColorConverter.cs
- CompositeDataBoundControl.cs
- MarkupCompilePass1.cs
- ProfileSettingsCollection.cs
- GlobalId.cs
- ClickablePoint.cs
- StrongNameUtility.cs
- BitmapEffectGroup.cs
- HyperLink.cs
- UrlMapping.cs
- SHA256.cs
- XmlEnumAttribute.cs
- TreeNodeStyleCollection.cs
- COM2IDispatchConverter.cs
- WorkflowServiceHost.cs
- VectorCollection.cs
- EntitySetRetriever.cs
- Tokenizer.cs
- InvokeDelegate.cs
- AudioException.cs
- BitStream.cs
- DataGridViewAutoSizeModeEventArgs.cs
- x509utils.cs
- FlowNode.cs
- ActivityDefaults.cs
- Cast.cs