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
- HybridDictionary.cs
- XmlSerializerImportOptions.cs
- InvalidCastException.cs
- BasicBrowserDialog.cs
- XmlSchemaAttribute.cs
- CertificateManager.cs
- SchemaInfo.cs
- OperationCanceledException.cs
- ConnectionsZone.cs
- InvokePatternIdentifiers.cs
- SpecialNameAttribute.cs
- ConfigurationManagerHelperFactory.cs
- Attribute.cs
- BinHexDecoder.cs
- VectorCollectionConverter.cs
- NestedContainer.cs
- EncoderExceptionFallback.cs
- PersonalizationAdministration.cs
- PageCache.cs
- _OSSOCK.cs
- Keywords.cs
- COM2FontConverter.cs
- CallbackDebugBehavior.cs
- OletxDependentTransaction.cs
- QueryStatement.cs
- LineSegment.cs
- DbExpressionBuilder.cs
- Int16Converter.cs
- FormView.cs
- TransactionBridge.cs
- SQLByteStorage.cs
- DoWorkEventArgs.cs
- Sequence.cs
- TabControlEvent.cs
- DockEditor.cs
- WsiProfilesElement.cs
- CrossSiteScriptingValidation.cs
- Context.cs
- ListenerElementsCollection.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- ReadingWritingEntityEventArgs.cs
- DataBindingHandlerAttribute.cs
- NetPipeSectionData.cs
- OdbcParameterCollection.cs
- GrammarBuilder.cs
- IsolatedStorageFileStream.cs
- OracleException.cs
- CharEnumerator.cs
- Point3DCollection.cs
- EntityProviderServices.cs
- DesignerSerializerAttribute.cs
- CorrelationTokenInvalidatedHandler.cs
- GeometryHitTestParameters.cs
- DockPanel.cs
- TriggerBase.cs
- WebSysDefaultValueAttribute.cs
- MenuEventArgs.cs
- ConnectionPoint.cs
- OledbConnectionStringbuilder.cs
- GridViewSortEventArgs.cs
- FormatterConverter.cs
- DbConvert.cs
- HasCopySemanticsAttribute.cs
- _NetRes.cs
- DataFormats.cs
- CommandManager.cs
- PageParser.cs
- SecurityTokenReferenceStyle.cs
- MarkupCompilePass1.cs
- NetSectionGroup.cs
- SmtpAuthenticationManager.cs
- XmlAttributeOverrides.cs
- TripleDESCryptoServiceProvider.cs
- Quaternion.cs
- ReadOnlyDictionary.cs
- safelink.cs
- EntityProviderServices.cs
- WMIInterop.cs
- WrapPanel.cs
- Faults.cs
- AtlasWeb.Designer.cs
- SettingsBase.cs
- cookieexception.cs
- TextChange.cs
- MetadataHelper.cs
- GuidelineCollection.cs
- CompiledRegexRunner.cs
- XmlDataSourceView.cs
- DependencyObject.cs
- cookieexception.cs
- ResXDataNode.cs
- PixelFormat.cs
- ConfigurationManagerHelperFactory.cs
- DataGridViewColumnTypePicker.cs
- RedirectionProxy.cs
- PointCollectionConverter.cs
- HostSecurityManager.cs
- EnvelopedPkcs7.cs
- MeshGeometry3D.cs
- RTLAwareMessageBox.cs