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
- RMEnrollmentPage1.cs
- arclist.cs
- MarkupExtensionParser.cs
- DateTimeConverter2.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- VisualStyleInformation.cs
- X509RawDataKeyIdentifierClause.cs
- SerializationEventsCache.cs
- BaseCollection.cs
- SqlBulkCopyColumnMappingCollection.cs
- PropertyGeneratedEventArgs.cs
- returneventsaver.cs
- Size3DValueSerializer.cs
- rsa.cs
- Point3DCollection.cs
- FirstMatchCodeGroup.cs
- BindingOperations.cs
- SynthesizerStateChangedEventArgs.cs
- TabOrder.cs
- SystemPens.cs
- TemplatedWizardStep.cs
- PropertyDescriptor.cs
- AssemblyAttributesGoHere.cs
- ParameterReplacerVisitor.cs
- ListBoxChrome.cs
- TextDecorationCollection.cs
- SqlConnectionPoolGroupProviderInfo.cs
- XPathSelectionIterator.cs
- EqualityComparer.cs
- TextTrailingCharacterEllipsis.cs
- WmlCalendarAdapter.cs
- DataGridViewCellCancelEventArgs.cs
- DataReceivedEventArgs.cs
- CfgArc.cs
- EntityDataSourceChangedEventArgs.cs
- FactoryGenerator.cs
- AddInAdapter.cs
- DataGridItemEventArgs.cs
- InternalMappingException.cs
- rsa.cs
- AstNode.cs
- VersionedStream.cs
- StructuredTypeEmitter.cs
- CaseStatement.cs
- ResourceDescriptionAttribute.cs
- AuthorizationRuleCollection.cs
- ListViewInsertEventArgs.cs
- ExpressionHelper.cs
- NegotiateStream.cs
- WsdlInspector.cs
- Semaphore.cs
- NativeMethods.cs
- TableStyle.cs
- DebugViewWriter.cs
- FileDialogCustomPlace.cs
- BamlReader.cs
- SHA256.cs
- TargetControlTypeAttribute.cs
- ScriptDescriptor.cs
- FormatConvertedBitmap.cs
- TraceRecord.cs
- EventlogProvider.cs
- X509Chain.cs
- ResXResourceWriter.cs
- XPathAncestorIterator.cs
- XmlSchemaChoice.cs
- FrameworkPropertyMetadata.cs
- AsyncWaitHandle.cs
- DataSvcMapFile.cs
- ApplyTemplatesAction.cs
- OutputCacheProfile.cs
- wgx_sdk_version.cs
- ExternalDataExchangeService.cs
- SqlUtils.cs
- QilFunction.cs
- InsufficientMemoryException.cs
- DecoderFallback.cs
- TypeBuilder.cs
- RestHandler.cs
- DataChangedEventManager.cs
- StructuredTypeInfo.cs
- ThumbAutomationPeer.cs
- ApplicationInfo.cs
- XmlSerializerAssemblyAttribute.cs
- EncoderReplacementFallback.cs
- XmlSchemaValidator.cs
- MenuItem.cs
- ProxySimple.cs
- OleDbWrapper.cs
- RenderContext.cs
- OutOfMemoryException.cs
- XmlSchemaObjectTable.cs
- AlternateView.cs
- ResXResourceSet.cs
- FormattedTextSymbols.cs
- NamedPipeChannelListener.cs
- Predicate.cs
- _SslStream.cs
- Lasso.cs
- ZipIOLocalFileDataDescriptor.cs