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
- regiisutil.cs
- Descriptor.cs
- KeysConverter.cs
- TargetControlTypeCache.cs
- COM2ComponentEditor.cs
- UpDownBase.cs
- SystemNetworkInterface.cs
- DataColumnPropertyDescriptor.cs
- LinkLabelLinkClickedEvent.cs
- RemotingAttributes.cs
- LiteralControl.cs
- FontInfo.cs
- DesigntimeLicenseContextSerializer.cs
- OleDbPermission.cs
- SqlSupersetValidator.cs
- MouseActionValueSerializer.cs
- ApplicationFileCodeDomTreeGenerator.cs
- XPathSelectionIterator.cs
- TextDpi.cs
- MenuCommandService.cs
- TransferMode.cs
- WindowInteropHelper.cs
- OleDbConnectionInternal.cs
- WindowsToolbarAsMenu.cs
- CommandHelpers.cs
- DateTimeFormatInfo.cs
- PrintEvent.cs
- XmlDocumentSerializer.cs
- EntryWrittenEventArgs.cs
- UnmanagedMemoryStreamWrapper.cs
- ListViewTableCell.cs
- ObservableCollection.cs
- MaskedTextBox.cs
- CapabilitiesAssignment.cs
- WindowShowOrOpenTracker.cs
- DataContractSet.cs
- VirtualPathProvider.cs
- HttpTransportSecurity.cs
- LineProperties.cs
- PartialTrustVisibleAssemblyCollection.cs
- SqlDataAdapter.cs
- Rule.cs
- ViewStateException.cs
- NumericExpr.cs
- HistoryEventArgs.cs
- SqlVersion.cs
- ConfigurationElementCollection.cs
- COM2PropertyDescriptor.cs
- PropertyEmitterBase.cs
- RectAnimation.cs
- ListContractAdapter.cs
- SiteMap.cs
- PropertySourceInfo.cs
- ETagAttribute.cs
- NavigationHelper.cs
- DragEvent.cs
- String.cs
- Menu.cs
- XmlAnyElementAttribute.cs
- ChildTable.cs
- SecureConversationSecurityTokenParameters.cs
- ErrorFormatterPage.cs
- FormsAuthenticationEventArgs.cs
- FilterQueryOptionExpression.cs
- StateDesigner.LayoutSelectionGlyph.cs
- RoleManagerSection.cs
- SafeSystemMetrics.cs
- Single.cs
- ReceiveSecurityHeaderElementManager.cs
- CompiledQuery.cs
- DataGridViewColumnTypePicker.cs
- DesignerEditorPartChrome.cs
- ValidationErrorEventArgs.cs
- BaseComponentEditor.cs
- GridViewRow.cs
- TextServicesCompartmentEventSink.cs
- ParentQuery.cs
- Int32CollectionConverter.cs
- SelectionEditor.cs
- HttpRuntime.cs
- NameSpaceEvent.cs
- Tokenizer.cs
- WebHttpDispatchOperationSelector.cs
- PictureBoxDesigner.cs
- SchemaMapping.cs
- MessageBox.cs
- HotSpotCollection.cs
- DataViewManagerListItemTypeDescriptor.cs
- ParameterCollection.cs
- oledbconnectionstring.cs
- ApplicationSecurityInfo.cs
- AccessDataSourceView.cs
- DesignerContextDescriptor.cs
- QilLiteral.cs
- MimeParameterWriter.cs
- ExpressionEvaluator.cs
- Visitors.cs
- Geometry3D.cs
- ContextMarshalException.cs
- EntityReference.cs