Code:
/ 4.0 / 4.0 / 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. 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
- ActivityValidator.cs
- OdbcRowUpdatingEvent.cs
- HwndStylusInputProvider.cs
- DataGridTableCollection.cs
- DataGridViewAutoSizeModeEventArgs.cs
- XmlHierarchicalDataSourceView.cs
- TypographyProperties.cs
- IEnumerable.cs
- SurrogateEncoder.cs
- XmlName.cs
- TransferMode.cs
- FontDialog.cs
- ResourcePermissionBase.cs
- NullableConverter.cs
- ReliableRequestSessionChannel.cs
- ListItemCollection.cs
- ThaiBuddhistCalendar.cs
- XmlSchemaException.cs
- XmlElement.cs
- XmlDownloadManager.cs
- MetadataItemCollectionFactory.cs
- AffineTransform3D.cs
- WarningException.cs
- CustomErrorsSectionWrapper.cs
- Ref.cs
- XmlCharType.cs
- DotAtomReader.cs
- CrossContextChannel.cs
- SudsWriter.cs
- X509Utils.cs
- EditCommandColumn.cs
- CmsInterop.cs
- DataGridLengthConverter.cs
- HtmlTableRowCollection.cs
- VisualStyleTypesAndProperties.cs
- XmlAttributeOverrides.cs
- SurrogateChar.cs
- BitmapCacheBrush.cs
- CompareValidator.cs
- RichListBox.cs
- bidPrivateBase.cs
- DataSourceSelectArguments.cs
- SystemMulticastIPAddressInformation.cs
- metadatamappinghashervisitor.cs
- DescendentsWalker.cs
- ImageCodecInfo.cs
- PathFigureCollectionValueSerializer.cs
- Drawing.cs
- SwitchElementsCollection.cs
- KeyValueConfigurationElement.cs
- TextRangeSerialization.cs
- SQLStringStorage.cs
- TextRangeProviderWrapper.cs
- SqlDataSourceQueryEditor.cs
- RedirectionProxy.cs
- SerializationInfo.cs
- EmptyEnumerator.cs
- TextShapeableCharacters.cs
- HttpGetProtocolReflector.cs
- XmlSchemaIdentityConstraint.cs
- InvalidComObjectException.cs
- Utils.cs
- StdValidatorsAndConverters.cs
- EntityDataSourceContainerNameConverter.cs
- EventMappingSettings.cs
- XNodeNavigator.cs
- RecordsAffectedEventArgs.cs
- RequestContext.cs
- CodeAttachEventStatement.cs
- SafeNativeMethods.cs
- ArrangedElement.cs
- HtmlTable.cs
- Int32.cs
- PropertyOverridesDialog.cs
- CacheRequest.cs
- SiteOfOriginPart.cs
- _NetworkingPerfCounters.cs
- BackgroundFormatInfo.cs
- CqlQuery.cs
- ManagedFilter.cs
- SingleAnimationBase.cs
- DataControlFieldHeaderCell.cs
- VisualTreeUtils.cs
- SQLMembershipProvider.cs
- DesignerTextViewAdapter.cs
- SafeNativeMethods.cs
- NaturalLanguageHyphenator.cs
- DisplayNameAttribute.cs
- QueryOutputWriter.cs
- XmlCharCheckingReader.cs
- TextParagraphView.cs
- ColorConverter.cs
- IsolatedStorageFile.cs
- TableLayoutStyleCollection.cs
- HandlerFactoryCache.cs
- CompoundFileReference.cs
- TrackingMemoryStreamFactory.cs
- TileBrush.cs
- CookieHandler.cs
- XmlSchemaAppInfo.cs