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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TypeLoadException.cs
- DefaultObjectMappingItemCollection.cs
- XamlPathDataSerializer.cs
- MouseOverProperty.cs
- TagMapInfo.cs
- CompatibleIComparer.cs
- ParamArrayAttribute.cs
- DoubleLinkList.cs
- ObjectTypeMapping.cs
- odbcmetadatacolumnnames.cs
- PersistenceTypeAttribute.cs
- UInt32.cs
- XmlNamespaceDeclarationsAttribute.cs
- CalendarKeyboardHelper.cs
- LogRestartAreaEnumerator.cs
- TextSelection.cs
- ListenUriMode.cs
- ChtmlMobileTextWriter.cs
- Gdiplus.cs
- XmlHelper.cs
- ProfileGroupSettings.cs
- GetMemberBinder.cs
- CustomAttributeFormatException.cs
- ObjectStateFormatter.cs
- InvalidFilterCriteriaException.cs
- TextBoxRenderer.cs
- DataControlPagerLinkButton.cs
- UpdatePanelControlTrigger.cs
- ReaderWriterLock.cs
- ViewStateException.cs
- QilPatternVisitor.cs
- GuidelineSet.cs
- Array.cs
- ItemCheckedEvent.cs
- DataBindEngine.cs
- ReversePositionQuery.cs
- HelpPage.cs
- ApplicationBuildProvider.cs
- OleDbDataAdapter.cs
- TrackingStringDictionary.cs
- Attributes.cs
- EventLogPermissionHolder.cs
- WebPartZoneCollection.cs
- ChangePassword.cs
- EventRouteFactory.cs
- StaticDataManager.cs
- MultiTouchSystemGestureLogic.cs
- CallbackValidator.cs
- ControlParameter.cs
- StringWriter.cs
- Image.cs
- XmlSchemaComplexContentRestriction.cs
- DiagnosticStrings.cs
- SID.cs
- ReturnType.cs
- DataTableReaderListener.cs
- SqlBuffer.cs
- Symbol.cs
- DesignerSerializationManager.cs
- PackagePart.cs
- Application.cs
- TabControlEvent.cs
- TCEAdapterGenerator.cs
- WebPartChrome.cs
- TreeNodeClickEventArgs.cs
- DuplicateWaitObjectException.cs
- AllMembershipCondition.cs
- XmlSchemaGroup.cs
- PersonalizablePropertyEntry.cs
- PrintControllerWithStatusDialog.cs
- ComboBox.cs
- Configuration.cs
- GraphicsPathIterator.cs
- QilSortKey.cs
- Comparer.cs
- SelectedGridItemChangedEvent.cs
- CodeTryCatchFinallyStatement.cs
- QuaternionAnimationUsingKeyFrames.cs
- ImageConverter.cs
- SqlCommandBuilder.cs
- ErrorTableItemStyle.cs
- InfoCardSymmetricCrypto.cs
- EditorPartChrome.cs
- UnsafeNativeMethods.cs
- WebConfigurationFileMap.cs
- TypeConstant.cs
- XmlEventCache.cs
- DataGridItemAutomationPeer.cs
- QualifiedCellIdBoolean.cs
- ConnectionPoolManager.cs
- StateFinalizationActivity.cs
- RemotingServices.cs
- WriteableBitmap.cs
- StringFreezingAttribute.cs
- ObjectDataSourceStatusEventArgs.cs
- HostProtectionPermission.cs
- RuleRef.cs
- WebHttpBindingElement.cs
- TextHidden.cs
- CodeDomSerializer.cs