Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / Command / KeyGestureValueSerializer.cs / 1305600 / KeyGestureValueSerializer.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: KeyGestureValueSerializer - Serializes a KeyGesture // to and from a string // // // History: // 08/04/2005 : Chuck Jazdzewski - Created // //--------------------------------------------------------------------------- using System; using System.ComponentModel; // for TypeConverter using System.Globalization; // for CultureInfo using System.Windows; using System.Windows.Input; using System.Windows.Markup; #pragma warning disable 1634, 1691 // suppressing PreSharp warnings namespace System.Windows.Input { ////// KeyGestureValueSerializer - Converter class for serializing a KeyGesture /// public class KeyGestureValueSerializer : ValueSerializer { ////// CanConvertFromString() /// /// /// ////// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } /// /// CanConvertToString() /// /// /// ////// public override bool CanConvertToString(object value, IValueSerializerContext context) { KeyGesture keyGesture = value as KeyGesture; #pragma warning disable 6506 return (keyGesture != null) && ModifierKeysConverter.IsDefinedModifierKeys(keyGesture.Modifiers) && KeyGestureConverter.IsDefinedKey(keyGesture.Key); #pragma warning restore 6506 } /// /// ConvertFromString() /// /// /// ///public override object ConvertFromString(string value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(KeyGesture)); 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(KeyGesture)); 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
- _NTAuthentication.cs
- CustomBindingElement.cs
- MethodBody.cs
- AutomationIdentifierGuids.cs
- ConsumerConnectionPointCollection.cs
- CaseKeyBox.xaml.cs
- shaperfactory.cs
- HMAC.cs
- XmlBufferedByteStreamReader.cs
- AvTraceFormat.cs
- ThreadStaticAttribute.cs
- MessageEncodingBindingElement.cs
- InputBinder.cs
- PixelFormats.cs
- GuidTagList.cs
- WebBrowserEvent.cs
- SettingsPropertyWrongTypeException.cs
- QilList.cs
- HostingMessageProperty.cs
- EntityDataSourceDesigner.cs
- OdbcRowUpdatingEvent.cs
- RowUpdatedEventArgs.cs
- TextEditorMouse.cs
- AuditLevel.cs
- SafeProcessHandle.cs
- CodeStatementCollection.cs
- DataBindingCollection.cs
- SingleObjectCollection.cs
- AttributeAction.cs
- InProcStateClientManager.cs
- Stack.cs
- EditorAttributeInfo.cs
- SoapEnvelopeProcessingElement.cs
- GroupPartitionExpr.cs
- SmiRecordBuffer.cs
- RectAnimationBase.cs
- TreeNodeClickEventArgs.cs
- ReferencedType.cs
- Part.cs
- DbConnectionHelper.cs
- ColorContext.cs
- EntitySet.cs
- _Semaphore.cs
- ConfigurationPermission.cs
- RequestSecurityTokenForGetBrowserToken.cs
- SafeNativeMethods.cs
- BindingSource.cs
- Section.cs
- ReachPrintTicketSerializer.cs
- PersonalizationProviderHelper.cs
- CultureInfoConverter.cs
- Dump.cs
- DesignerProperties.cs
- DocumentViewer.cs
- CalloutQueueItem.cs
- SelectedCellsChangedEventArgs.cs
- ViewValidator.cs
- MenuItemCollection.cs
- InternalDispatchObject.cs
- DbConnectionPoolOptions.cs
- Int32KeyFrameCollection.cs
- LinkedResource.cs
- metadatamappinghashervisitor.cs
- ICspAsymmetricAlgorithm.cs
- Parameter.cs
- RelationshipType.cs
- iisPickupDirectory.cs
- EnterpriseServicesHelper.cs
- WebBodyFormatMessageProperty.cs
- VisualBrush.cs
- IChannel.cs
- GetWorkflowTree.cs
- HTMLTagNameToTypeMapper.cs
- SqlFlattener.cs
- EncryptedReference.cs
- wgx_sdk_version.cs
- Group.cs
- ClassValidator.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- RegexRunnerFactory.cs
- DefaultSerializationProviderAttribute.cs
- TraceProvider.cs
- PolyBezierSegment.cs
- Hex.cs
- InteropAutomationProvider.cs
- SelectionBorderGlyph.cs
- CollectionViewSource.cs
- StaticResourceExtension.cs
- MembershipSection.cs
- SystemNetHelpers.cs
- ThicknessAnimation.cs
- CompilerHelpers.cs
- ApplicationGesture.cs
- ScriptIgnoreAttribute.cs
- AssemblyBuilder.cs
- ToolStripCodeDomSerializer.cs
- CodeCommentStatementCollection.cs
- ColorAnimationUsingKeyFrames.cs
- TemplateControl.cs
- DescendentsWalkerBase.cs