Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Input / Command / RoutedUICommand.cs / 2 / 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
- FormViewPageEventArgs.cs
- SizeFConverter.cs
- XslTransformFileEditor.cs
- PenContexts.cs
- DrawingAttributesDefaultValueFactory.cs
- QilTargetType.cs
- DetailsViewPagerRow.cs
- Formatter.cs
- WebPartMenuStyle.cs
- TagPrefixInfo.cs
- HttpRequestWrapper.cs
- XPathScanner.cs
- WaveHeader.cs
- TransformDescriptor.cs
- SourceElementsCollection.cs
- HttpDictionary.cs
- FixUpCollection.cs
- NullableConverter.cs
- Win32Native.cs
- DecoderFallback.cs
- SamlSecurityTokenAuthenticator.cs
- CustomGrammar.cs
- Not.cs
- Util.cs
- StylusPointProperties.cs
- OrderingExpression.cs
- DefaultParameterValueAttribute.cs
- SafeRightsManagementSessionHandle.cs
- ErrorLog.cs
- PermissionSetEnumerator.cs
- WS2007FederationHttpBinding.cs
- TransformerInfoCollection.cs
- DbProviderFactories.cs
- StorageEntitySetMapping.cs
- MarshalByValueComponent.cs
- EdmItemError.cs
- SplitterEvent.cs
- XmlWrappingReader.cs
- Matrix.cs
- XmlName.cs
- DataAdapter.cs
- WindowProviderWrapper.cs
- documentation.cs
- FileChangesMonitor.cs
- XdrBuilder.cs
- ValidationError.cs
- XmlSchemaFacet.cs
- MtomMessageEncodingElement.cs
- ToolboxComponentsCreatedEventArgs.cs
- PartitionedStreamMerger.cs
- PolicyException.cs
- RuntimeHelpers.cs
- Task.cs
- XmlElement.cs
- IISUnsafeMethods.cs
- OdbcTransaction.cs
- CompilationSection.cs
- TraceEventCache.cs
- SimpleRecyclingCache.cs
- WCFServiceClientProxyGenerator.cs
- Model3DCollection.cs
- WindowsComboBox.cs
- DoWorkEventArgs.cs
- Attributes.cs
- BaseDataListComponentEditor.cs
- Sql8ConformanceChecker.cs
- MSAAEventDispatcher.cs
- Menu.cs
- CodeVariableDeclarationStatement.cs
- RootAction.cs
- GridItem.cs
- AnonymousIdentificationModule.cs
- ColorConvertedBitmap.cs
- StorageEndPropertyMapping.cs
- DotExpr.cs
- __ComObject.cs
- FilteredDataSetHelper.cs
- PerformanceCounterCategory.cs
- ServiceObjectContainer.cs
- NativeObjectSecurity.cs
- InvalidProgramException.cs
- SqlErrorCollection.cs
- sortedlist.cs
- ZoneIdentityPermission.cs
- TransactionTable.cs
- TransformerConfigurationWizardBase.cs
- SiteMapHierarchicalDataSourceView.cs
- CellQuery.cs
- FrameworkTextComposition.cs
- Marshal.cs
- DispatcherHookEventArgs.cs
- DateTimeSerializationSection.cs
- XmlElement.cs
- DeviceContext.cs
- CfgSemanticTag.cs
- CodeGenerator.cs
- GAC.cs
- DiscoveryDocumentReference.cs
- HttpClientCertificate.cs
- LoginView.cs