Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ContextMenu.cs
- ButtonRenderer.cs
- SafeEventHandle.cs
- TreeChangeInfo.cs
- RectAnimationUsingKeyFrames.cs
- ScrollItemPattern.cs
- TimelineCollection.cs
- ListBindingHelper.cs
- OverflowException.cs
- CacheHelper.cs
- StorageScalarPropertyMapping.cs
- FixedSOMContainer.cs
- PropertyEmitter.cs
- RequiredFieldValidator.cs
- CommandBinding.cs
- GroupBox.cs
- AuthorizationRule.cs
- AlphabeticalEnumConverter.cs
- EnumConverter.cs
- SpeakInfo.cs
- PerformanceCounterPermissionEntryCollection.cs
- PropertyCondition.cs
- ColumnBinding.cs
- SharedConnectionWorkflowTransactionService.cs
- RadioButtonFlatAdapter.cs
- PageAsyncTaskManager.cs
- processwaithandle.cs
- AddInControllerImpl.cs
- StringWriter.cs
- GlobalizationAssembly.cs
- MasterPageCodeDomTreeGenerator.cs
- BuilderPropertyEntry.cs
- QueueProcessor.cs
- XPathNavigatorKeyComparer.cs
- RewritingPass.cs
- SiteMembershipCondition.cs
- CustomAttribute.cs
- ReferenceSchema.cs
- ErrorWrapper.cs
- DataGridViewColumnCollectionEditor.cs
- TextEndOfSegment.cs
- DocumentOutline.cs
- CodeTypeParameterCollection.cs
- MessageSecurityOverHttp.cs
- MessageQueueInstaller.cs
- EndpointIdentity.cs
- XmlDictionaryReaderQuotas.cs
- _ListenerAsyncResult.cs
- TileBrush.cs
- OutputCacheSection.cs
- SortedList.cs
- FtpCachePolicyElement.cs
- PieceNameHelper.cs
- StorageMappingItemLoader.cs
- HtmlDocument.cs
- Point3DCollection.cs
- FrameDimension.cs
- ShutDownListener.cs
- OleDbEnumerator.cs
- SystemColors.cs
- TextEmbeddedObject.cs
- DbMetaDataFactory.cs
- DynamicILGenerator.cs
- ExtenderProvidedPropertyAttribute.cs
- SchemaAttDef.cs
- ReadOnlyTernaryTree.cs
- DataSourceSelectArguments.cs
- ExternalException.cs
- DocumentViewerHelper.cs
- XmlLanguage.cs
- Scripts.cs
- CurrentChangingEventArgs.cs
- SqlDataAdapter.cs
- SequentialOutput.cs
- _BasicClient.cs
- Section.cs
- NativeStructs.cs
- WebPartTracker.cs
- ArgIterator.cs
- Monitor.cs
- PhoneCallDesigner.cs
- handlecollector.cs
- Profiler.cs
- CancelEventArgs.cs
- PropertyPath.cs
- Point3DKeyFrameCollection.cs
- SoapElementAttribute.cs
- DbParameterCollectionHelper.cs
- VariableQuery.cs
- SettingsProperty.cs
- SoapReflector.cs
- UserControlFileEditor.cs
- GetCryptoTransformRequest.cs
- PinnedBufferMemoryStream.cs
- SuppressMessageAttribute.cs
- DocumentEventArgs.cs
- RichTextBoxAutomationPeer.cs
- WsdlParser.cs
- TrackBarDesigner.cs
- URLIdentityPermission.cs