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
- TemplateParser.cs
- HyperLinkStyle.cs
- ConstNode.cs
- Calendar.cs
- EmptyCollection.cs
- ToolboxDataAttribute.cs
- DataGridViewRow.cs
- Encoder.cs
- HMACSHA1.cs
- JoinTreeNode.cs
- HTMLTagNameToTypeMapper.cs
- DiagnosticTrace.cs
- validationstate.cs
- IriParsingElement.cs
- LinqDataView.cs
- PageResolution.cs
- dataSvcMapFileLoader.cs
- TextTreeUndoUnit.cs
- ParseHttpDate.cs
- CodeConditionStatement.cs
- DiscoveryDocumentSearchPattern.cs
- SqlMethods.cs
- WorkflowInstanceProvider.cs
- TextPenaltyModule.cs
- ScaleTransform.cs
- SecurityException.cs
- Win32PrintDialog.cs
- PagedDataSource.cs
- SafePEFileHandle.cs
- EventItfInfo.cs
- AuthenticationModuleElementCollection.cs
- HtmlHead.cs
- LoginUtil.cs
- SafeHGlobalHandleCritical.cs
- ConfigurationCollectionAttribute.cs
- DataBindingHandlerAttribute.cs
- SplineQuaternionKeyFrame.cs
- Int64.cs
- WebScriptServiceHostFactory.cs
- IItemContainerGenerator.cs
- ConstructorExpr.cs
- RegexCompilationInfo.cs
- Point3DValueSerializer.cs
- TypeNameConverter.cs
- GeneralTransform3DTo2D.cs
- CompressedStack.cs
- Serialization.cs
- DataGridColumnEventArgs.cs
- DisplayInformation.cs
- EntitySetBaseCollection.cs
- TakeQueryOptionExpression.cs
- ObservableCollection.cs
- HtmlSelect.cs
- ExpressionSelection.cs
- TransformationRules.cs
- CultureTable.cs
- XmlSchemaComplexType.cs
- OSFeature.cs
- HitTestFilterBehavior.cs
- DataGridViewComboBoxColumn.cs
- wgx_commands.cs
- ThousandthOfEmRealDoubles.cs
- ScrollBar.cs
- MetadataArtifactLoaderCompositeResource.cs
- SelectorAutomationPeer.cs
- ViewManagerAttribute.cs
- PropertyChangedEventArgs.cs
- XamlStyleSerializer.cs
- ConfigurationManagerHelperFactory.cs
- WebBrowserContainer.cs
- SecurityImpersonationBehavior.cs
- ComponentCollection.cs
- TextRangeEditTables.cs
- OleDbWrapper.cs
- GorillaCodec.cs
- ScriptRegistrationManager.cs
- MenuItemBindingCollection.cs
- PreviewKeyDownEventArgs.cs
- Constants.cs
- DecimalMinMaxAggregationOperator.cs
- SendContent.cs
- StylusOverProperty.cs
- HuffModule.cs
- AxisAngleRotation3D.cs
- MenuBase.cs
- ExternalFile.cs
- WebPartUserCapability.cs
- AdvancedBindingPropertyDescriptor.cs
- ipaddressinformationcollection.cs
- BaseComponentEditor.cs
- CodeIterationStatement.cs
- SelectionItemProviderWrapper.cs
- Tool.cs
- BooleanSwitch.cs
- HtmlInputButton.cs
- GenericTextProperties.cs
- XmlSchemaSimpleType.cs
- SpecularMaterial.cs
- HandoffBehavior.cs
- SmtpReplyReaderFactory.cs