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
- DataObjectMethodAttribute.cs
- SubtreeProcessor.cs
- DataGridColumnFloatingHeader.cs
- BitmapEffectInputConnector.cs
- FileVersion.cs
- TypeName.cs
- Drawing.cs
- NullRuntimeConfig.cs
- _AutoWebProxyScriptWrapper.cs
- TypeConverterAttribute.cs
- ExclusiveCanonicalizationTransform.cs
- HebrewCalendar.cs
- ExpressionBindingCollection.cs
- WebPartActionVerb.cs
- SerializationInfo.cs
- HtmlHead.cs
- BindingEditor.xaml.cs
- SQLChars.cs
- ListItemConverter.cs
- VerificationException.cs
- xmlglyphRunInfo.cs
- DataGridViewCellPaintingEventArgs.cs
- IIS7ConfigurationLoader.cs
- LoadWorkflowByKeyAsyncResult.cs
- FrameworkElementFactory.cs
- RowToParametersTransformer.cs
- PlainXmlWriter.cs
- ChtmlPageAdapter.cs
- CounterSampleCalculator.cs
- __FastResourceComparer.cs
- SourceFilter.cs
- DataListItem.cs
- MeasureItemEvent.cs
- WebRequestModulesSection.cs
- SearchForVirtualItemEventArgs.cs
- ManifestBasedResourceGroveler.cs
- DataRelationCollection.cs
- XsdValidatingReader.cs
- TypedTableBaseExtensions.cs
- RSAPKCS1SignatureFormatter.cs
- NativeMethods.cs
- QualifiedId.cs
- CacheEntry.cs
- Rotation3DAnimation.cs
- AxisAngleRotation3D.cs
- DefinitionBase.cs
- CustomAssemblyResolver.cs
- MonthCalendar.cs
- PointAnimationUsingPath.cs
- JsonWriterDelegator.cs
- InkPresenterAutomationPeer.cs
- PreservationFileReader.cs
- SqlRetyper.cs
- OracleDataReader.cs
- HttpFileCollection.cs
- recordstatefactory.cs
- FacetValues.cs
- SchemaElementDecl.cs
- VariableQuery.cs
- PageThemeBuildProvider.cs
- Random.cs
- BidPrivateBase.cs
- _SingleItemRequestCache.cs
- ServiceContractDetailViewControl.cs
- CodeEventReferenceExpression.cs
- CodeDefaultValueExpression.cs
- IntegerFacetDescriptionElement.cs
- FilterElement.cs
- SecurityPermission.cs
- ProvidePropertyAttribute.cs
- ToolZone.cs
- TdsParameterSetter.cs
- XmlSchemaGroup.cs
- XmlCharCheckingReader.cs
- PolyLineSegment.cs
- NativeCompoundFileAPIs.cs
- ColorPalette.cs
- ElementMarkupObject.cs
- RSAOAEPKeyExchangeFormatter.cs
- NumericUpDownAcceleration.cs
- DrawingImage.cs
- MaskedTextProvider.cs
- FileChangesMonitor.cs
- FixedSOMTextRun.cs
- PrintDocument.cs
- SetStoryboardSpeedRatio.cs
- TranslateTransform.cs
- RotateTransform3D.cs
- OracleNumber.cs
- NotifyParentPropertyAttribute.cs
- SocketException.cs
- CodeIdentifiers.cs
- WebPartExportVerb.cs
- DBSchemaRow.cs
- BinHexEncoder.cs
- SqlDataSourceCache.cs
- ColumnMapProcessor.cs
- InputDevice.cs
- GestureRecognizer.cs
- OracleDateTime.cs