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
- InternalConfigHost.cs
- XmlQueryType.cs
- SingleTagSectionHandler.cs
- ColorComboBox.cs
- smtppermission.cs
- MsmqIntegrationBindingCollectionElement.cs
- EmbeddedMailObject.cs
- DayRenderEvent.cs
- RichTextBoxConstants.cs
- SendMailErrorEventArgs.cs
- UDPClient.cs
- StateRuntime.cs
- CodeNamespaceImportCollection.cs
- MetadataItem_Static.cs
- ColumnCollection.cs
- BinaryNode.cs
- SpnegoTokenProvider.cs
- BindingList.cs
- ReadOnlyHierarchicalDataSource.cs
- DataServiceResponse.cs
- HwndProxyElementProvider.cs
- FamilyCollection.cs
- ComponentRenameEvent.cs
- DataGrid.cs
- VersionedStream.cs
- SmtpFailedRecipientsException.cs
- ContentFileHelper.cs
- StylusDevice.cs
- ApplicationActivator.cs
- WorkflowOperationFault.cs
- EditorPart.cs
- PromptBuilder.cs
- AccessText.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- SqlMethodCallConverter.cs
- NumericExpr.cs
- EventToken.cs
- RemotingConfigParser.cs
- Attributes.cs
- ProfilePropertySettings.cs
- Int32KeyFrameCollection.cs
- FontNamesConverter.cs
- CheckBoxBaseAdapter.cs
- ListManagerBindingsCollection.cs
- NativeMethods.cs
- TimeSpanValidator.cs
- Size3DValueSerializer.cs
- DebugInfoExpression.cs
- DataListItemCollection.cs
- ReadOnlyCollection.cs
- CloseCryptoHandleRequest.cs
- CacheMemory.cs
- KeyValueConfigurationCollection.cs
- PipelineModuleStepContainer.cs
- SocketStream.cs
- BooleanExpr.cs
- ISCIIEncoding.cs
- BindingUtils.cs
- RegularExpressionValidator.cs
- FileInfo.cs
- EncoderNLS.cs
- WebPartCancelEventArgs.cs
- HashSet.cs
- SqlFlattener.cs
- WebPartPersonalization.cs
- RtfToXamlReader.cs
- SqlMethods.cs
- _DigestClient.cs
- ResXDataNode.cs
- WindowsIPAddress.cs
- AuthorizationRule.cs
- ButtonFlatAdapter.cs
- BaseTemplateParser.cs
- IndicCharClassifier.cs
- CardSpaceException.cs
- OptionUsage.cs
- GridSplitterAutomationPeer.cs
- StylusButtonCollection.cs
- StaticTextPointer.cs
- Animatable.cs
- TypeDependencyAttribute.cs
- TextEffectCollection.cs
- ComponentCommands.cs
- ReadOnlyDictionary.cs
- Registry.cs
- ExponentialEase.cs
- XmlNamespaceMapping.cs
- AsyncContentLoadedEventArgs.cs
- SynchronizationContextHelper.cs
- NavigationWindow.cs
- CodeMemberEvent.cs
- BitmapEffectDrawingContent.cs
- LineInfo.cs
- GPStream.cs
- followingsibling.cs
- CurrentChangingEventManager.cs
- PackageProperties.cs
- ListViewSelectEventArgs.cs
- AtomMaterializer.cs
- HandlerBase.cs