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
- ResourceExpression.cs
- AxisAngleRotation3D.cs
- SynchronizedInputHelper.cs
- GenericIdentity.cs
- ChannelRequirements.cs
- SqlVersion.cs
- DocumentSchemaValidator.cs
- NetworkAddressChange.cs
- FontUnit.cs
- SoapRpcServiceAttribute.cs
- TransformValueSerializer.cs
- ProfileSection.cs
- DbDataAdapter.cs
- OdbcStatementHandle.cs
- HtmlInputText.cs
- FontStretches.cs
- UIElementHelper.cs
- WithStatement.cs
- DrawToolTipEventArgs.cs
- Debug.cs
- SoapFormatterSinks.cs
- ListParaClient.cs
- UIAgentRequest.cs
- XmlSchemaInclude.cs
- XmlDictionaryReaderQuotas.cs
- MimeObjectFactory.cs
- PrintEvent.cs
- ImageButton.cs
- FixedLineResult.cs
- CompiledQuery.cs
- InputBindingCollection.cs
- XmlEntity.cs
- SqlParameter.cs
- PropertyPathWorker.cs
- SqlNode.cs
- MILUtilities.cs
- MruCache.cs
- ServiceDebugElement.cs
- CharAnimationBase.cs
- ChannelServices.cs
- ISAPIRuntime.cs
- DoubleLinkListEnumerator.cs
- QualifierSet.cs
- TemplatedMailWebEventProvider.cs
- SendActivityDesigner.cs
- PermissionToken.cs
- MdiWindowListItemConverter.cs
- BasicKeyConstraint.cs
- DataServiceQueryException.cs
- IDQuery.cs
- XamlFxTrace.cs
- PreviewPageInfo.cs
- TextEffectCollection.cs
- ChtmlPageAdapter.cs
- TrackingParticipant.cs
- ProcessModelInfo.cs
- Animatable.cs
- TextTreeRootTextBlock.cs
- ClientSettings.cs
- ApplicationManager.cs
- FormViewUpdatedEventArgs.cs
- CustomAttribute.cs
- SamlConditions.cs
- ProfileServiceManager.cs
- IncrementalCompileAnalyzer.cs
- BamlBinaryWriter.cs
- ConnectionManagementSection.cs
- SimpleHandlerBuildProvider.cs
- SystemColorTracker.cs
- webclient.cs
- Control.cs
- EntitySetBase.cs
- XmlSchemaAttributeGroupRef.cs
- ServiceContractListItem.cs
- ScrollableControl.cs
- PageSetupDialog.cs
- KeySplineConverter.cs
- Convert.cs
- ContourSegment.cs
- MediaCommands.cs
- WebCategoryAttribute.cs
- HashSet.cs
- SkewTransform.cs
- ExpressionEditorSheet.cs
- HttpServerChannel.cs
- DesignTimeVisibleAttribute.cs
- ThumbButtonInfoCollection.cs
- ListItemCollection.cs
- ConfigurationSectionGroup.cs
- NetMsmqSecurityMode.cs
- DoWorkEventArgs.cs
- FlowDocumentReader.cs
- StringPropertyBuilder.cs
- ComponentEvent.cs
- TypeTypeConverter.cs
- CorrelationQuery.cs
- NameValueSectionHandler.cs
- TargetInvocationException.cs
- WhitespaceRuleLookup.cs
- TextPenaltyModule.cs