Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / System / Windows / Input / ModifierKeysValueSerializer.cs / 1305600 / ModifierKeysValueSerializer.cs
//---------------------------------------------------------------------------- // // File: ModifierKeysValueSerializer.cs // // Description: // // ModifierKeysValueSerializer : Serializes a Modifier to and from a string. // // Features: // // History: // 08/04/2005 created: Chuck Jazdzewski // // Copyright (C) 2005 by Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; // for TypeConverter using System.Globalization; // for CultureInfo using System.Reflection; using MS.Internal; using System.Windows; using System.Windows.Input; using System.Windows.Markup; using MS.Utility; namespace System.Windows.Input { ////// Key Converter class for converting between a string and the Type of a Modifiers /// ///public class ModifierKeysValueSerializer : ValueSerializer { /// /// CanConvertFromString() /// /// /// ////// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } /// /// CanConvertToString() /// /// /// ////// public override bool CanConvertToString(object value, IValueSerializerContext context) { return (value is ModifierKeys) && ModifierKeysConverter.IsDefinedModifierKeys((ModifierKeys)value); } /// /// ConvertFromString() /// /// /// ///public override object ConvertFromString(string value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(ModifierKeys)); 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(ModifierKeys)); 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. //---------------------------------------------------------------------------- // // File: ModifierKeysValueSerializer.cs // // Description: // // ModifierKeysValueSerializer : Serializes a Modifier to and from a string. // // Features: // // History: // 08/04/2005 created: Chuck Jazdzewski // // Copyright (C) 2005 by Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; // for TypeConverter using System.Globalization; // for CultureInfo using System.Reflection; using MS.Internal; using System.Windows; using System.Windows.Input; using System.Windows.Markup; using MS.Utility; namespace System.Windows.Input { /// /// Key Converter class for converting between a string and the Type of a Modifiers /// ///public class ModifierKeysValueSerializer : ValueSerializer { /// /// CanConvertFromString() /// /// /// ////// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } /// /// CanConvertToString() /// /// /// ////// public override bool CanConvertToString(object value, IValueSerializerContext context) { return (value is ModifierKeys) && ModifierKeysConverter.IsDefinedModifierKeys((ModifierKeys)value); } /// /// ConvertFromString() /// /// /// ///public override object ConvertFromString(string value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(ModifierKeys)); 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(ModifierKeys)); 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
- ControlParameter.cs
- InstanceDataCollectionCollection.cs
- ObjectDataSource.cs
- WebPartZoneCollection.cs
- ExpressionConverter.cs
- Win32Exception.cs
- SessionStateSection.cs
- TextHidden.cs
- BamlCollectionHolder.cs
- CustomAttributeSerializer.cs
- safesecurityhelperavalon.cs
- MultipartContentParser.cs
- MaterializeFromAtom.cs
- SafeNativeMethodsMilCoreApi.cs
- DefinitionUpdate.cs
- codemethodreferenceexpression.cs
- UnsafeNativeMethods.cs
- ExceptionCollection.cs
- BulletedList.cs
- COM2PictureConverter.cs
- LassoHelper.cs
- XamlSerializerUtil.cs
- TopClause.cs
- Queue.cs
- BindingBase.cs
- XmlILModule.cs
- XamlRtfConverter.cs
- ColorConvertedBitmap.cs
- TreeNodeMouseHoverEvent.cs
- TrackingCondition.cs
- Aggregates.cs
- CodeDefaultValueExpression.cs
- _NtlmClient.cs
- TypefaceMetricsCache.cs
- ISO2022Encoding.cs
- GeneralTransform3DTo2DTo3D.cs
- X509UI.cs
- EntityType.cs
- GrammarBuilderWildcard.cs
- XmlArrayAttribute.cs
- DataBoundControlHelper.cs
- TextEditorSpelling.cs
- TdsRecordBufferSetter.cs
- DataGridViewComboBoxColumn.cs
- RequestContext.cs
- NavigationPropertyEmitter.cs
- HttpRuntimeSection.cs
- VerificationException.cs
- ScrollItemPatternIdentifiers.cs
- Int16AnimationBase.cs
- SHA384Managed.cs
- ContentPosition.cs
- XmlAttributeProperties.cs
- AssemblyNameProxy.cs
- SymLanguageType.cs
- ComponentResourceKeyConverter.cs
- securitycriticaldata.cs
- DataServiceQueryException.cs
- DataColumnCollection.cs
- EnumUnknown.cs
- PersistenceProviderDirectory.cs
- ProfileBuildProvider.cs
- PropertyEmitterBase.cs
- LambdaExpression.cs
- ToggleProviderWrapper.cs
- DataGridBoolColumn.cs
- RenderOptions.cs
- SecurityPolicySection.cs
- SqlPersonalizationProvider.cs
- RectangleGeometry.cs
- PrintControllerWithStatusDialog.cs
- MaskedTextBoxTextEditorDropDown.cs
- SecurityTokenSpecification.cs
- Font.cs
- HttpContext.cs
- SiteMap.cs
- IndexOutOfRangeException.cs
- _CookieModule.cs
- DataListCommandEventArgs.cs
- Point3DValueSerializer.cs
- GridViewCommandEventArgs.cs
- Expressions.cs
- XmlSchemaCompilationSettings.cs
- BitmapEffectGroup.cs
- DiscreteKeyFrames.cs
- SecureStringHasher.cs
- BuildProvidersCompiler.cs
- CopyOnWriteList.cs
- DetectRunnableInstancesTask.cs
- GeneralTransform3DTo2DTo3D.cs
- RectangleConverter.cs
- GC.cs
- SqlConnectionHelper.cs
- DataRecordInfo.cs
- SafeThreadHandle.cs
- TemplateBamlTreeBuilder.cs
- UpdateCommand.cs
- CodeArrayIndexerExpression.cs
- OleDbDataAdapter.cs
- SingleTagSectionHandler.cs