Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / DataObjectEventArgs.cs / 1 / 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
- InternalBufferOverflowException.cs
- UserControlFileEditor.cs
- LabelDesigner.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- DefinitionBase.cs
- HotCommands.cs
- DataErrorValidationRule.cs
- SoapInteropTypes.cs
- HtmlHead.cs
- KeyNotFoundException.cs
- TextParagraph.cs
- _ShellExpression.cs
- ObjectManager.cs
- X509CertificateCollection.cs
- Localizer.cs
- _FtpDataStream.cs
- RuntimeHandles.cs
- XmlSerializerVersionAttribute.cs
- DCSafeHandle.cs
- XmlSerializerNamespaces.cs
- EntityDataSourceDesigner.cs
- WebPartHeaderCloseVerb.cs
- TdsParserSafeHandles.cs
- ReaderWriterLock.cs
- TreeNodeBindingCollection.cs
- ControlBindingsConverter.cs
- WrappedIUnknown.cs
- ExpressionBinding.cs
- WindowsFormsHostPropertyMap.cs
- SchemaImporter.cs
- OdbcReferenceCollection.cs
- ShaderEffect.cs
- wgx_sdk_version.cs
- DataGridViewColumnStateChangedEventArgs.cs
- SafeLibraryHandle.cs
- PrincipalPermission.cs
- ModelTreeEnumerator.cs
- RadioButtonPopupAdapter.cs
- ExcCanonicalXml.cs
- CommandID.cs
- CharacterBuffer.cs
- DelimitedListTraceListener.cs
- SpellCheck.cs
- SafeEventLogWriteHandle.cs
- TextShapeableCharacters.cs
- RuntimeIdentifierPropertyAttribute.cs
- InterleavedZipPartStream.cs
- TagMapInfo.cs
- ConfigurationPermission.cs
- DataBindingExpressionBuilder.cs
- TraceListeners.cs
- Transactions.cs
- LinkConverter.cs
- Utility.cs
- OletxDependentTransaction.cs
- OleDbPropertySetGuid.cs
- DocumentSequenceHighlightLayer.cs
- WebBrowserNavigatingEventHandler.cs
- CompareInfo.cs
- CFGGrammar.cs
- SamlAssertion.cs
- UrlPath.cs
- EdmConstants.cs
- MetafileHeader.cs
- XmlWriter.cs
- ExpressionBindingCollection.cs
- DelegateTypeInfo.cs
- DefaultMergeHelper.cs
- PopupRootAutomationPeer.cs
- OdbcDataAdapter.cs
- HMACSHA384.cs
- _OSSOCK.cs
- JournalEntryStack.cs
- ListControlBuilder.cs
- JoinElimination.cs
- BaseTemplateBuildProvider.cs
- LocatorPartList.cs
- WebPartConnectionsConnectVerb.cs
- SafeViewOfFileHandle.cs
- AsyncContentLoadedEventArgs.cs
- InternalConfigEventArgs.cs
- SchemaTypeEmitter.cs
- RotateTransform3D.cs
- precedingquery.cs
- DataGridItemCollection.cs
- PropertyEmitterBase.cs
- XmlSerializerNamespaces.cs
- TabControl.cs
- ToolStripItemClickedEventArgs.cs
- SQLBinaryStorage.cs
- DictionaryCustomTypeDescriptor.cs
- RequestBringIntoViewEventArgs.cs
- EnumerableRowCollection.cs
- PanelStyle.cs
- PngBitmapDecoder.cs
- ControlParameter.cs
- CodeChecksumPragma.cs
- MediaTimeline.cs
- MemberProjectionIndex.cs
- StateItem.cs