Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Input / Command / MouseBinding.cs / 1 / MouseBinding.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: The MouseBinding class is used by the developer to create Mouse Input Bindings // // See spec at : [....]/coreui/Specs/Commanding(new).mht // //* MouseBinding class serves the purpose of Input Bindings for Mouse Device. // // History: // 06/01/2003 : [....] - Created // 05/01/2004 : [....]- changed to new design. //--------------------------------------------------------------------------- using System; using System.Windows.Input; using System.Windows; using System.Windows.Markup; using System.ComponentModel; using SR=MS.Internal.PresentationCore.SR; using SRID=MS.Internal.PresentationCore.SRID; namespace System.Windows.Input { ////// MouseBinding - Implements InputBinding (generic InputGesture-Command map) /// MouseBinding acts like a map for MouseGesture and Commands. /// Most of the logic is in InputBinding and MouseGesture, this only /// facilitates user to specify MouseAction directly without going in /// MouseGesture path. Also it provides the MouseGestureTypeConverter /// on the Gesture property to have MouseGesture, like "RightClick" /// defined in Markup as Gesture="RightClick" working. /// public class MouseBinding : InputBinding { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors ////// constructor /// public MouseBinding() : base() { } ////// Constructor /// /// Command Associated /// Mouse Action internal MouseBinding(ICommand command, MouseAction mouseAction) : this(command, new MouseGesture(mouseAction)) { } ////// Constructor /// /// Command Associated /// Mmouse Gesture associated public MouseBinding(ICommand command, MouseGesture gesture) : base(command, gesture) { } #endregion Constructors //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- #region Public Methods ////// MouseGesture /// [TypeConverter(typeof(MouseGestureConverter))] [ValueSerializer(typeof(MouseGestureValueSerializer))] public override InputGesture Gesture { get { return base.Gesture as MouseGesture; } set { if (value is MouseGesture) { base.Gesture = value; } else { throw new ArgumentException(SR.Get(SRID.InputBinding_ExpectedInputGesture, typeof(MouseGesture))); } } } #endregion Public Methods //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ //----------------------------------------------------- // // Public Methods // //----------------------------------------------------- #region Public Methods ////// MouseAction /// public MouseAction MouseAction { get { lock (_dataLock) { if (null != Gesture) { return ((MouseGesture)Gesture).MouseAction; } return MouseAction.None; } } set { lock (_dataLock) { if (null == Gesture) { Gesture = new MouseGesture((MouseAction)value); } else { ((MouseGesture)Gesture).MouseAction = (MouseAction)value; } } } } #endregion Public Methods //----------------------------------------------------- // // 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
- ErasingStroke.cs
- DateTimeStorage.cs
- FileDialog_Vista.cs
- SimpleBitVector32.cs
- XPathNodeIterator.cs
- FixedSOMTableRow.cs
- ConsoleKeyInfo.cs
- CompareValidator.cs
- ColumnWidthChangingEvent.cs
- RadioButtonDesigner.cs
- Timer.cs
- WebPartCatalogAddVerb.cs
- Base64Stream.cs
- XPathParser.cs
- CommandConverter.cs
- MultipartIdentifier.cs
- XsdValidatingReader.cs
- SafeNativeMethods.cs
- MissingMemberException.cs
- BaseComponentEditor.cs
- JpegBitmapDecoder.cs
- DescendantOverDescendantQuery.cs
- BrowserCapabilitiesFactoryBase.cs
- ReferenceEqualityComparer.cs
- Operators.cs
- SafePEFileHandle.cs
- InternalEnumValidator.cs
- MimePart.cs
- ExtensibleClassFactory.cs
- ResourceWriter.cs
- ReversePositionQuery.cs
- BitConverter.cs
- ProtectedConfigurationSection.cs
- FileIOPermission.cs
- AlignmentXValidation.cs
- RequestDescription.cs
- figurelength.cs
- LassoSelectionBehavior.cs
- CapabilitiesSection.cs
- QuestionEventArgs.cs
- StringValidator.cs
- Claim.cs
- TimeSpanMinutesConverter.cs
- GenerateHelper.cs
- RTLAwareMessageBox.cs
- EncryptedXml.cs
- ForwardPositionQuery.cs
- CompiledELinqQueryState.cs
- Type.cs
- TypedServiceOperationListItem.cs
- Point3DAnimationUsingKeyFrames.cs
- StateMachine.cs
- TextBox.cs
- TabPageDesigner.cs
- ExpressionEditorAttribute.cs
- GeneralEndpointIdentity.cs
- COM2Enum.cs
- SafeEventLogReadHandle.cs
- DurableInstance.cs
- TableLayoutCellPaintEventArgs.cs
- ChildDocumentBlock.cs
- ConnectionPoint.cs
- ContextCorrelationInitializer.cs
- Activity.cs
- xsdvalidator.cs
- ListParagraph.cs
- Memoizer.cs
- RawMouseInputReport.cs
- Int32CollectionConverter.cs
- PropagatorResult.cs
- BamlStream.cs
- SmiXetterAccessMap.cs
- DesignerSerializationOptionsAttribute.cs
- SmtpNegotiateAuthenticationModule.cs
- ItemsChangedEventArgs.cs
- CommentAction.cs
- XmlILStorageConverter.cs
- MaskedTextBox.cs
- WebColorConverter.cs
- UserValidatedEventArgs.cs
- EventLogger.cs
- BackgroundFormatInfo.cs
- StandardCommands.cs
- XamlUtilities.cs
- EventProviderWriter.cs
- DragDeltaEventArgs.cs
- SetMemberBinder.cs
- WebPartMinimizeVerb.cs
- SingleKeyFrameCollection.cs
- PathFigureCollectionValueSerializer.cs
- TextReader.cs
- XmlBaseReader.cs
- SqlWriter.cs
- MenuItemAutomationPeer.cs
- MarkupExtensionSerializer.cs
- CheckBoxAutomationPeer.cs
- HandlerFactoryCache.cs
- Hyperlink.cs
- TypeExtension.cs
- ButtonFieldBase.cs