Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Input / Command / MouseGestureValueSerializer.cs / 1 / MouseGestureValueSerializer.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: MouseGestureValueSerializer - Serializes a MouseGesture // // History: // 08/04/2005 : Chuck Jazdzewski - Created // //--------------------------------------------------------------------------- using System; using System.ComponentModel; // for TypeConverter using System.Globalization; // for CultureInfo using System.Reflection; using System.Windows; using System.Windows.Input; using System.Windows.Markup; namespace System.Windows.Input { ////// MouseGesture - Converter class for converting between a string and the Type of a MouseGesture /// public class MouseGestureValueSerializer : ValueSerializer { ////// CanConvertFromString() /// /// /// ////// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } /// /// CanConvertToString() /// /// /// ////// public override bool CanConvertToString(object value, IValueSerializerContext context) { bool result = false; MouseGesture mouseGesture = value as MouseGesture; if(mouseGesture != null) { if(ModifierKeysConverter.IsDefinedModifierKeys(mouseGesture.Modifiers) && MouseActionConverter.IsDefinedMouseAction(mouseGesture.MouseAction)) { result = true; } } return result; } /// /// ConvertFromString() /// /// /// ///public override object ConvertFromString(string value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(MouseGesture)); if (converter != null) return converter.ConvertFromString(value); else return base.ConvertFromString(value, context); } /// /// ConvertToString() /// /// /// ///public override string ConvertToString(object value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(MouseGesture)); if (converter != null) return converter.ConvertToInvariantString(value); else return base.ConvertToString(value, context); } } } // 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
- XmlSchemaException.cs
- DoubleLink.cs
- Roles.cs
- TCPListener.cs
- ThreadLocal.cs
- GradientBrush.cs
- SQLMoneyStorage.cs
- DelegateHelpers.Generated.cs
- OdbcTransaction.cs
- StateFinalizationActivity.cs
- Win32Exception.cs
- webclient.cs
- ControlPaint.cs
- MailSettingsSection.cs
- SystemUnicastIPAddressInformation.cs
- DataGridViewColumnEventArgs.cs
- MatrixAnimationUsingPath.cs
- DataFormat.cs
- BuildProviderUtils.cs
- ContentPresenter.cs
- Terminate.cs
- DataGridSortCommandEventArgs.cs
- TemplateControlBuildProvider.cs
- DataGridViewRowStateChangedEventArgs.cs
- SafeFileMappingHandle.cs
- Inline.cs
- BStrWrapper.cs
- PrivateFontCollection.cs
- datacache.cs
- ACL.cs
- WebBrowserNavigatedEventHandler.cs
- ListBindingConverter.cs
- QuerySafeNavigator.cs
- VectorAnimationBase.cs
- GridView.cs
- TransactionManager.cs
- SqlCacheDependencySection.cs
- DateTimeValueSerializerContext.cs
- CodeMemberProperty.cs
- CryptoHelper.cs
- Property.cs
- SqlServices.cs
- IPEndPointCollection.cs
- RuntimeConfigurationRecord.cs
- RuntimeUtils.cs
- LogManagementAsyncResult.cs
- updateconfighost.cs
- ButtonField.cs
- HScrollBar.cs
- TextDecoration.cs
- XmlDataImplementation.cs
- RenderOptions.cs
- TextSimpleMarkerProperties.cs
- ServiceHttpModule.cs
- PriorityQueue.cs
- XmlSchemaObject.cs
- ConfigXmlSignificantWhitespace.cs
- ServiceModelTimeSpanValidator.cs
- WindowProviderWrapper.cs
- StreamReader.cs
- SrgsGrammarCompiler.cs
- ApplicationTrust.cs
- ReachFixedDocumentSerializer.cs
- WindowsSpinner.cs
- ResourceBinder.cs
- InvariantComparer.cs
- DataRecord.cs
- ManagementOperationWatcher.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- HtmlHead.cs
- PrivilegeNotHeldException.cs
- RadioButtonAutomationPeer.cs
- RevocationPoint.cs
- ExtensibleClassFactory.cs
- Label.cs
- XmlSchemaInclude.cs
- BaseValidator.cs
- WizardSideBarListControlItemEventArgs.cs
- XmlSchemaSimpleContentRestriction.cs
- HashAlgorithm.cs
- EdmItemCollection.cs
- CloseSequence.cs
- InputScopeConverter.cs
- TemplateBindingExtensionConverter.cs
- ConfigurationSectionCollection.cs
- EventLogTraceListener.cs
- DriveNotFoundException.cs
- Clipboard.cs
- HttpsHostedTransportConfiguration.cs
- BitmapSourceSafeMILHandle.cs
- BitVector32.cs
- SplitterEvent.cs
- CollectionType.cs
- ListMarkerSourceInfo.cs
- EventMemberCodeDomSerializer.cs
- GridSplitter.cs
- ComponentSerializationService.cs
- OleDbRowUpdatingEvent.cs
- Transform3DGroup.cs
- IdlingCommunicationPool.cs