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
- ParentUndoUnit.cs
- Int16Storage.cs
- SafeHandles.cs
- XmlILAnnotation.cs
- PageThemeParser.cs
- VisualBasicSettings.cs
- DataRowCollection.cs
- CancellationToken.cs
- TabItemAutomationPeer.cs
- SqlUserDefinedAggregateAttribute.cs
- OleDbReferenceCollection.cs
- SqlExpressionNullability.cs
- WindowsListViewSubItem.cs
- AutomationEventArgs.cs
- StringComparer.cs
- DataTrigger.cs
- BaseAddressPrefixFilterElementCollection.cs
- WCFBuildProvider.cs
- Int32CollectionConverter.cs
- HeaderCollection.cs
- loginstatus.cs
- Fonts.cs
- RegionData.cs
- FontInfo.cs
- X509CertificateEndpointIdentity.cs
- LoginAutoFormat.cs
- XmlSchemaSimpleTypeList.cs
- ViewEventArgs.cs
- TextServicesLoader.cs
- ConstNode.cs
- XmlValidatingReader.cs
- MarkupProperty.cs
- ShapingWorkspace.cs
- RenderContext.cs
- GeneralTransformGroup.cs
- AnnotationResourceChangedEventArgs.cs
- ButtonAutomationPeer.cs
- FileDataSourceCache.cs
- GraphicsPathIterator.cs
- SystemIPInterfaceStatistics.cs
- Identity.cs
- ScriptReferenceBase.cs
- BindingManagerDataErrorEventArgs.cs
- PropertyGridView.cs
- TextRenderer.cs
- ElementMarkupObject.cs
- SynchronizedInputHelper.cs
- AnonymousIdentificationModule.cs
- UrlPath.cs
- Substitution.cs
- TextEditorTables.cs
- EndpointDispatcher.cs
- TextCompositionManager.cs
- DataKey.cs
- XmlSchemaInferenceException.cs
- XPathNodeHelper.cs
- ProtocolsSection.cs
- DataGridViewTopRowAccessibleObject.cs
- WindowsPen.cs
- WindowsSpinner.cs
- Events.cs
- Cloud.cs
- DataSourceSelectArguments.cs
- LinkedResource.cs
- QilTargetType.cs
- XmlDocumentType.cs
- CurrentTimeZone.cs
- SelectedDatesCollection.cs
- StrokeRenderer.cs
- Model3D.cs
- SqlPersonalizationProvider.cs
- WindowsListView.cs
- WebPartAuthorizationEventArgs.cs
- ObjectContext.cs
- ActiveXContainer.cs
- TypeValidationEventArgs.cs
- ExecutionEngineException.cs
- LinqDataSourceView.cs
- Imaging.cs
- SolidColorBrush.cs
- FontFamily.cs
- PropertyInformationCollection.cs
- RegexStringValidator.cs
- GeneratedContractType.cs
- DispatcherProcessingDisabled.cs
- SectionInformation.cs
- HebrewNumber.cs
- RC2.cs
- TableRow.cs
- OpenTypeLayoutCache.cs
- DecimalKeyFrameCollection.cs
- NotImplementedException.cs
- CompModHelpers.cs
- IDispatchConstantAttribute.cs
- Signature.cs
- AssemblyBuilder.cs
- util.cs
- CodeTypeConstructor.cs
- DetailsViewModeEventArgs.cs
- CompositeDataBoundControl.cs