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
- BitmapEffectrendercontext.cs
- IdnMapping.cs
- ToolStripDropDownClosedEventArgs.cs
- StringBuilder.cs
- RadioButtonPopupAdapter.cs
- VisualTransition.cs
- AssemblyCache.cs
- IFlowDocumentViewer.cs
- ToolStripRenderEventArgs.cs
- FilteredDataSetHelper.cs
- printdlgexmarshaler.cs
- EventsTab.cs
- TimeSpanOrInfiniteValidator.cs
- BooleanProjectedSlot.cs
- Ticks.cs
- EditingCoordinator.cs
- DataListCommandEventArgs.cs
- TextPointerBase.cs
- DiscoveryMessageSequenceCD1.cs
- RuleSettingsCollection.cs
- OptionalColumn.cs
- AsyncStreamReader.cs
- BatchParser.cs
- SignatureToken.cs
- ImmComposition.cs
- BezierSegment.cs
- UrlMappingCollection.cs
- XslTransform.cs
- XmlHierarchicalEnumerable.cs
- LineSegment.cs
- ColorInterpolationModeValidation.cs
- HtmlTableRow.cs
- RectangleGeometry.cs
- DataGridItemAutomationPeer.cs
- Set.cs
- Peer.cs
- BrushValueSerializer.cs
- SliderAutomationPeer.cs
- InfoCardService.cs
- StringUtil.cs
- QilVisitor.cs
- BufferModesCollection.cs
- DependentList.cs
- Boolean.cs
- PenContexts.cs
- DataSourceView.cs
- PageContentAsyncResult.cs
- SafeNativeMethods.cs
- Wildcard.cs
- HttpListenerRequest.cs
- WebPartsPersonalizationAuthorization.cs
- TextElementAutomationPeer.cs
- LocalBuilder.cs
- SymDocumentType.cs
- OptionalColumn.cs
- Camera.cs
- EncryptedReference.cs
- CodeDefaultValueExpression.cs
- CharEnumerator.cs
- Publisher.cs
- GridViewPageEventArgs.cs
- HttpWebResponse.cs
- wmiutil.cs
- CompilerParameters.cs
- Scripts.cs
- HTTPAPI_VERSION.cs
- Scheduling.cs
- TextBlockAutomationPeer.cs
- TrackingLocation.cs
- MultiSelectRootGridEntry.cs
- LinqToSqlWrapper.cs
- UnsafeNativeMethodsPenimc.cs
- GridViewAutomationPeer.cs
- _AuthenticationState.cs
- EncryptRequest.cs
- XmlSchemaProviderAttribute.cs
- AuthenticationException.cs
- KeyValuePair.cs
- ProfileParameter.cs
- DoWorkEventArgs.cs
- TdsParserStaticMethods.cs
- CreateInstanceBinder.cs
- GlobalItem.cs
- SkewTransform.cs
- Facet.cs
- AppDomainFactory.cs
- BinaryObjectReader.cs
- WebBrowser.cs
- SqlTransaction.cs
- webproxy.cs
- DescendentsWalker.cs
- ResolveNameEventArgs.cs
- GeneralTransform2DTo3DTo2D.cs
- Normalization.cs
- SequentialWorkflowHeaderFooter.cs
- BinaryFormatter.cs
- ListSourceHelper.cs
- Rfc2898DeriveBytes.cs
- ProviderIncompatibleException.cs
- GridViewCommandEventArgs.cs