Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / Command / RoutedUICommand.cs / 1305600 / RoutedUICommand.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; // for TypeConverter using System.Windows; using System.Windows.Markup; using System.Windows.Media; namespace System.Windows.Input { ////// RoutedCommand with added UI Information. /// [TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=" + Microsoft.Internal.BuildInfo.WCP_VERSION + ", Culture=neutral, PublicKeyToken=" + Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_TOKEN + ", Custom=null")] public class RoutedUICommand : RoutedCommand { ////// Default Constructor - needed to allow markup creation /// public RoutedUICommand() : base() { _text = String.Empty; } ////// Creates an instance of this class. /// /// Descriptive and localizable text for the command /// Declared Name of the RoutedCommand for Serialization /// Type that is registering the property public RoutedUICommand(string text, string name, Type ownerType) : this(text, name, ownerType, null) { } ////// Creates an instance of this class. /// /// Descriptive and localizable text for the command /// Declared Name of the RoutedCommand for Serialization /// Type that is registering the property /// Default Input Gestures associated public RoutedUICommand(string text, string name, Type ownerType, InputGestureCollection inputGestures) : base(name, ownerType, inputGestures) { if (text == null) { throw new ArgumentNullException("text"); } _text = text; } ////// Creates an instance of this class. Allows lazy initialization of InputGestureCollection and Text properties. /// /// Declared Name of the RoutedCommand for Serialization /// Type that is registering the property /// An identifier assigned by the owning type to the command internal RoutedUICommand(string name, Type ownerType, byte commandId):base(name, ownerType, commandId) { } ////// Descriptive and localizable text for the command. /// public string Text { get { if(_text == null) { _text = GetText(); } return _text; } set { if (value == null) { throw new ArgumentNullException("value"); } _text = value; } } ////// Fetches the text by invoking the GetUIText function on the owning type. /// ///The text for the command private string GetText() { if(OwnerType == typeof(ApplicationCommands)) { return ApplicationCommands.GetUIText(CommandId); } else if(OwnerType == typeof(NavigationCommands)) { return NavigationCommands.GetUIText(CommandId); } else if(OwnerType == typeof(MediaCommands)) { return MediaCommands.GetUIText(CommandId); } else if(OwnerType == typeof(ComponentCommands)) { return ComponentCommands.GetUIText(CommandId); } return null; } private string _text; } } // 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
- NumberFunctions.cs
- ServerValidateEventArgs.cs
- Boolean.cs
- sortedlist.cs
- DbConnectionOptions.cs
- FixedSOMLineRanges.cs
- UpdatePanelTrigger.cs
- ValidationSummary.cs
- SerializableReadOnlyDictionary.cs
- DecimalAnimation.cs
- StructuralCache.cs
- CmsUtils.cs
- SafeMILHandle.cs
- NegotiateStream.cs
- ApplicationFileCodeDomTreeGenerator.cs
- OneToOneMappingSerializer.cs
- WebBrowserNavigatingEventHandler.cs
- BitmapEffectInputData.cs
- SyndicationDeserializer.cs
- OdbcParameter.cs
- HttpCapabilitiesSectionHandler.cs
- SafeMarshalContext.cs
- FontFamily.cs
- Rotation3DAnimation.cs
- IntSecurity.cs
- HeaderedItemsControl.cs
- SettingsPropertyValueCollection.cs
- SystemIPv6InterfaceProperties.cs
- DataComponentMethodGenerator.cs
- WorkflowServiceNamespace.cs
- PaginationProgressEventArgs.cs
- DataGridCommandEventArgs.cs
- XamlReaderHelper.cs
- AbsoluteQuery.cs
- OdbcStatementHandle.cs
- WindowsAuthenticationModule.cs
- SystemIPv6InterfaceProperties.cs
- WebSysDescriptionAttribute.cs
- JsonStringDataContract.cs
- ExpressionBuilderContext.cs
- DecoderFallback.cs
- SQlBooleanStorage.cs
- Error.cs
- PixelShader.cs
- TextEditorCopyPaste.cs
- WebServiceTypeData.cs
- X509CertificateClaimSet.cs
- TypeHelpers.cs
- MethodSignatureGenerator.cs
- StickyNoteHelper.cs
- NumberSubstitution.cs
- RelationshipConstraintValidator.cs
- SecurityRuntime.cs
- RelationshipConstraintValidator.cs
- ListBox.cs
- ListBindingHelper.cs
- _NegotiateClient.cs
- DbConnectionStringBuilder.cs
- MoveSizeWinEventHandler.cs
- ReferenceEqualityComparer.cs
- Matrix.cs
- PerformanceCounterManager.cs
- XamlPointCollectionSerializer.cs
- Processor.cs
- TabControl.cs
- CommonDialog.cs
- SchemaImporterExtensionsSection.cs
- TreeNodeClickEventArgs.cs
- EntityContainerEntitySet.cs
- CacheMemory.cs
- smtpconnection.cs
- Clock.cs
- DrawingContext.cs
- DefaultValueMapping.cs
- EncoderParameters.cs
- TemplateControlParser.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- Speller.cs
- GroupQuery.cs
- ArraySortHelper.cs
- DataGridSortCommandEventArgs.cs
- controlskin.cs
- XmlReflectionImporter.cs
- BoundField.cs
- SHA256.cs
- _AcceptOverlappedAsyncResult.cs
- DefaultTextStoreTextComposition.cs
- SymbolUsageManager.cs
- X509CertificateTokenFactoryCredential.cs
- EntityDataSourceWrapperCollection.cs
- AssociatedControlConverter.cs
- xmlsaver.cs
- StorageScalarPropertyMapping.cs
- RegexTree.cs
- HyperLinkColumn.cs
- DataGridViewButtonColumn.cs
- UnsafeNativeMethods.cs
- RawKeyboardInputReport.cs
- ValidationError.cs
- PermissionAttributes.cs