Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Input / Command / KeyGestureValueSerializer.cs / 1 / 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
- AuthenticateEventArgs.cs
- TableLayoutPanelCellPosition.cs
- CompatibleIComparer.cs
- WmpBitmapDecoder.cs
- ExpandableObjectConverter.cs
- ServerTooBusyException.cs
- ViewRendering.cs
- indexingfiltermarshaler.cs
- GlobalItem.cs
- FormatterServices.cs
- MenuItem.cs
- ReadOnlyDataSourceView.cs
- TdsValueSetter.cs
- CustomError.cs
- ResourceBinder.cs
- DeobfuscatingStream.cs
- TextFormatter.cs
- RawStylusInputCustomDataList.cs
- MenuItemBinding.cs
- ProfileSettingsCollection.cs
- SingleTagSectionHandler.cs
- ManualResetEvent.cs
- ConditionCollection.cs
- ResourceSetExpression.cs
- FixedSOMPageConstructor.cs
- DataGridTablesFactory.cs
- ResourceExpressionEditor.cs
- SystemResources.cs
- OpenTypeCommon.cs
- DocumentStream.cs
- FlatButtonAppearance.cs
- IdentityManager.cs
- SettingsSection.cs
- SettingsPropertyIsReadOnlyException.cs
- TextEditorSpelling.cs
- DiscoveryReferences.cs
- ObjectHandle.cs
- ShaperBuffers.cs
- cookie.cs
- ParameterBinding.cs
- ByteStorage.cs
- TableItemStyle.cs
- serverconfig.cs
- DataControlFieldTypeEditor.cs
- EnumCodeDomSerializer.cs
- NTAccount.cs
- Pair.cs
- OutOfProcStateClientManager.cs
- TraceEventCache.cs
- DataSourceControlBuilder.cs
- PageWrapper.cs
- PolyQuadraticBezierSegment.cs
- Message.cs
- SessionState.cs
- ThemeableAttribute.cs
- LogSwitch.cs
- _AutoWebProxyScriptHelper.cs
- GacUtil.cs
- SpeechUI.cs
- DropDownButton.cs
- regiisutil.cs
- ListViewItem.cs
- XmlHierarchicalDataSourceView.cs
- MultiDataTrigger.cs
- ColorMap.cs
- ScalarOps.cs
- ModulesEntry.cs
- ContentIterators.cs
- Application.cs
- EffectiveValueEntry.cs
- DBSqlParserTable.cs
- ErrorsHelper.cs
- LineInfo.cs
- SqlUnionizer.cs
- ITextView.cs
- AvTrace.cs
- RankException.cs
- CodeTypeMemberCollection.cs
- XsltCompileContext.cs
- BufferedGraphics.cs
- _NegoStream.cs
- SHA256CryptoServiceProvider.cs
- LocatorPartList.cs
- Operators.cs
- QuaternionValueSerializer.cs
- Crc32.cs
- TraceSource.cs
- EllipseGeometry.cs
- LineInfo.cs
- OutputCacheSection.cs
- InfoCardSymmetricAlgorithm.cs
- IArgumentProvider.cs
- CqlLexer.cs
- ProfileEventArgs.cs
- DataBindingCollection.cs
- PropertyOrder.cs
- ProfileModule.cs
- BulletedList.cs
- FileClassifier.cs
- Choices.cs