Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Base / System / Windows / Input / KeyValueSerializer.cs / 1 / KeyValueSerializer.cs
//---------------------------------------------------------------------------- // // File: KeyValueSerializer.cs // // Description: // // KeyValueSerializer: Serializes a key string to a string and vice-versa // // 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 System.Windows; using System.Windows.Input; using System.Windows.Markup; using System.Security.Permissions; using MS.Utility; namespace System.Windows.Input { ////// Key Serializer class for serializing a Key /// ///public class KeyValueSerializer : ValueSerializer { /// /// CanConvertFromString() /// /// /// ////// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } /// /// CanConvertToString() /// /// /// ////// public override bool CanConvertToString(object value, IValueSerializerContext context) { if (!(value is Key)) return false; Key key = (Key)value; return ((int)key >= (int)Key.None && (int)key <= (int)Key.OemClear); } /// /// ConvertFromString() /// /// /// ///public override object ConvertFromString(string value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(Key)); 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(Key)); 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
- IPAddress.cs
- ReaderContextStackData.cs
- CompilationLock.cs
- RangeValueProviderWrapper.cs
- SrgsElementFactoryCompiler.cs
- BmpBitmapDecoder.cs
- PerformanceCounterLib.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- StdValidatorsAndConverters.cs
- WinInetCache.cs
- GC.cs
- WebPartCollection.cs
- WorkflowDesignerMessageFilter.cs
- CurrentTimeZone.cs
- UICuesEvent.cs
- EventMap.cs
- ParameterBuilder.cs
- LifetimeServices.cs
- XmlDataDocument.cs
- ImportDesigner.xaml.cs
- RowType.cs
- MultiViewDesigner.cs
- SafeProcessHandle.cs
- ExpressionBindings.cs
- DataSourceConverter.cs
- StyleTypedPropertyAttribute.cs
- UInt32Converter.cs
- CellRelation.cs
- FileReservationCollection.cs
- CollectionType.cs
- COAUTHINFO.cs
- DataGridViewDataErrorEventArgs.cs
- DataGridTable.cs
- SafeRegistryKey.cs
- DbParameterHelper.cs
- ControlTemplate.cs
- SerialPinChanges.cs
- SiteMembershipCondition.cs
- TransactionFlowProperty.cs
- BinaryObjectInfo.cs
- StateDesigner.TransitionInfo.cs
- ExplicitDiscriminatorMap.cs
- SelectionListDesigner.cs
- XmlRawWriterWrapper.cs
- TypeTypeConverter.cs
- RoutedEventArgs.cs
- WebBrowserSiteBase.cs
- AncestorChangedEventArgs.cs
- BinaryFormatterWriter.cs
- FormsAuthentication.cs
- WebPartTracker.cs
- RuleConditionDialog.Designer.cs
- ErasingStroke.cs
- AuthenticatingEventArgs.cs
- VectorKeyFrameCollection.cs
- PolicyLevel.cs
- SmtpFailedRecipientsException.cs
- FileSecurity.cs
- ButtonField.cs
- AutoCompleteStringCollection.cs
- SqlServices.cs
- BeginEvent.cs
- RowType.cs
- MarkupWriter.cs
- XPathDocumentNavigator.cs
- SelectionPattern.cs
- HttpApplicationFactory.cs
- AnnotationService.cs
- QilChoice.cs
- SqlNodeAnnotations.cs
- EventListenerClientSide.cs
- EdmPropertyAttribute.cs
- SessionStateContainer.cs
- RenamedEventArgs.cs
- WindowsAuthenticationEventArgs.cs
- ColorMatrix.cs
- ProgressBar.cs
- AttributeUsageAttribute.cs
- XmlSerializationGeneratedCode.cs
- MaskDescriptor.cs
- InputProcessorProfiles.cs
- XhtmlBasicTextBoxAdapter.cs
- HTTPNotFoundHandler.cs
- FixedSOMGroup.cs
- CollectionDataContract.cs
- KoreanLunisolarCalendar.cs
- FocusChangedEventArgs.cs
- WmpBitmapEncoder.cs
- WebPartConnectionsConnectVerb.cs
- DataMisalignedException.cs
- NGCSerializationManagerAsync.cs
- SecurityPolicyVersion.cs
- GeneratedCodeAttribute.cs
- OraclePermissionAttribute.cs
- Point4D.cs
- TemplateInstanceAttribute.cs
- AccessDataSourceWizardForm.cs
- PresentationSource.cs
- GlyphsSerializer.cs
- SimpleTypeResolver.cs