Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / FrameworkElementAutomationPeer.cs / 1305600 / FrameworkElementAutomationPeer.cs
using System; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Windows; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Markup; using MS.Internal; using MS.Win32; namespace System.Windows.Automation.Peers { /// public class FrameworkElementAutomationPeer : UIElementAutomationPeer { /// public FrameworkElementAutomationPeer(FrameworkElement owner) : base(owner) { } /// protected override string GetAutomationIdCore() { // 1. fetch AutomationProperties.AutomationIdProperty string result = base.GetAutomationIdCore(); if (string.IsNullOrEmpty(result)) { // 2. fetch x:Uid FrameworkElement owner = (FrameworkElement)Owner; result = Owner.Uid; if (string.IsNullOrEmpty(result)) { // 3. fetch FrameworkElement.NameProperty result = owner.Name; } } return result ?? string.Empty; } /// override protected string GetNameCore() { string result = base.GetNameCore(); if (string.IsNullOrEmpty(result)) { AutomationPeer labelAutomationPeer = GetLabeledByCore(); if (labelAutomationPeer != null) result = labelAutomationPeer.GetName(); if (string.IsNullOrEmpty(result)) result = ((FrameworkElement)Owner).GetPlainText(); } return result ?? string.Empty; } /// protected override string GetHelpTextCore() { string result = base.GetHelpTextCore(); if (string.IsNullOrEmpty(result)) { object toolTip = ((FrameworkElement)Owner).ToolTip; if (toolTip != null) { result = toolTip as string; if (string.IsNullOrEmpty(result)) { FrameworkElement toolTipElement = toolTip as FrameworkElement; if (toolTipElement != null) result = toolTipElement.GetPlainText(); } } } return result ?? String.Empty; } } } // 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
- HijriCalendar.cs
- InvalidStoreProtectionKeyException.cs
- StrongName.cs
- Error.cs
- PatternMatcher.cs
- NavigationPropertyEmitter.cs
- QilIterator.cs
- Stacktrace.cs
- WebPartConnectionsConnectVerb.cs
- CryptoApi.cs
- Sorting.cs
- TraceAsyncResult.cs
- RegisteredDisposeScript.cs
- ProviderSettingsCollection.cs
- BaseDataListPage.cs
- counter.cs
- ExpressionBuilder.cs
- FloaterParagraph.cs
- SchemaMapping.cs
- TextEncodedRawTextWriter.cs
- WebControlParameterProxy.cs
- ConfigXmlText.cs
- UpdatePanelTrigger.cs
- SingleKeyFrameCollection.cs
- CodeArgumentReferenceExpression.cs
- WorkerRequest.cs
- WithStatement.cs
- HotSpotCollection.cs
- PropertyGeneratedEventArgs.cs
- DbConnectionPoolIdentity.cs
- UpdateCommand.cs
- Pair.cs
- VirtualPath.cs
- RegexMatchCollection.cs
- SyndicationFeed.cs
- MessagePartProtectionMode.cs
- XmlStreamStore.cs
- LiteralControl.cs
- ObservableDictionary.cs
- FolderNameEditor.cs
- RoutedCommand.cs
- ControlIdConverter.cs
- EdmError.cs
- Listbox.cs
- UInt16Storage.cs
- xmlfixedPageInfo.cs
- TemplateControl.cs
- GatewayIPAddressInformationCollection.cs
- CustomWebEventKey.cs
- Size3D.cs
- QilLoop.cs
- StateMachineSubscriptionManager.cs
- Region.cs
- NoneExcludedImageIndexConverter.cs
- MDIControlStrip.cs
- SQLGuid.cs
- GridSplitter.cs
- _Rfc2616CacheValidators.cs
- XmlSchemaCompilationSettings.cs
- CounterCreationDataCollection.cs
- MappingMetadataHelper.cs
- UnsafeNativeMethods.cs
- SqlParameterCollection.cs
- Predicate.cs
- SocketInformation.cs
- GeneralTransformGroup.cs
- Viewport3DVisual.cs
- ErrorView.xaml.cs
- ConfigDefinitionUpdates.cs
- DirectoryInfo.cs
- BindingBase.cs
- FixedTextSelectionProcessor.cs
- EntityProviderServices.cs
- LinqDataSourceDeleteEventArgs.cs
- BadImageFormatException.cs
- Size.cs
- MimeWriter.cs
- DispatcherExceptionEventArgs.cs
- ConfigurationValidatorAttribute.cs
- ColorContextHelper.cs
- SelfIssuedAuthAsymmetricKey.cs
- BackgroundFormatInfo.cs
- XmlReflectionImporter.cs
- ListViewItem.cs
- EntityDataSourceUtil.cs
- XmlMtomWriter.cs
- NamedPipeProcessProtocolHandler.cs
- SharedPerformanceCounter.cs
- SoapServerMessage.cs
- AssemblyFilter.cs
- Vector3D.cs
- ECDiffieHellman.cs
- IteratorDescriptor.cs
- ValidationHelper.cs
- StyleCollectionEditor.cs
- GregorianCalendarHelper.cs
- DragSelectionMessageFilter.cs
- GrammarBuilderWildcard.cs
- WebContentFormatHelper.cs
- ConfigurationException.cs