Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Automation / Peers / FrameworkElementAutomationPeer.cs / 2 / 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; } /// override protected AutomationPeer GetLabeledByCore() { AutomationPeer labelPeer = base.GetLabeledByCore(); if (labelPeer == null) { Label label = Label.GetLabeledBy(Owner); if (label != null) return label.GetAutomationPeer(); } return null; } } } // 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; } /// override protected AutomationPeer GetLabeledByCore() { AutomationPeer labelPeer = base.GetLabeledByCore(); if (labelPeer == null) { Label label = Label.GetLabeledBy(Owner); if (label != null) return label.GetAutomationPeer(); } return null; } } } // 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
- MarshalByValueComponent.cs
- TextModifier.cs
- NamespaceExpr.cs
- Camera.cs
- ThemeConfigurationDialog.cs
- XmlArrayItemAttribute.cs
- ActivationArguments.cs
- PointAnimationBase.cs
- DisplayNameAttribute.cs
- UIElement3DAutomationPeer.cs
- TripleDESCryptoServiceProvider.cs
- NetSectionGroup.cs
- CalendarAutoFormat.cs
- NextPreviousPagerField.cs
- ExtensionSimplifierMarkupObject.cs
- ResourceProviderFactory.cs
- SymmetricKeyWrap.cs
- MissingMethodException.cs
- MasterPage.cs
- WebPartCatalogAddVerb.cs
- XPathDocumentNavigator.cs
- CompilationPass2Task.cs
- FontSizeConverter.cs
- NetStream.cs
- ObjectDataSourceStatusEventArgs.cs
- AttributeEmitter.cs
- CookieParameter.cs
- FrameworkElement.cs
- DecimalAnimationBase.cs
- AddressHeaderCollectionElement.cs
- Thumb.cs
- SupportsEventValidationAttribute.cs
- WaitHandleCannotBeOpenedException.cs
- Graph.cs
- TextLine.cs
- GlyphRunDrawing.cs
- GenericEnumerator.cs
- PageRanges.cs
- TrackBar.cs
- DataGridViewCellValidatingEventArgs.cs
- BuiltInExpr.cs
- BitmapEffectState.cs
- ContactManager.cs
- ActivityStatusChangeEventArgs.cs
- ProcessInfo.cs
- HttpChannelHelper.cs
- XmlHierarchicalDataSourceView.cs
- FilterException.cs
- BooleanExpr.cs
- InputLanguageProfileNotifySink.cs
- Assembly.cs
- ACE.cs
- RequestSecurityTokenResponse.cs
- DetailsViewDeletedEventArgs.cs
- Permission.cs
- QilTargetType.cs
- CultureInfoConverter.cs
- WorkflowViewElement.cs
- RichTextBoxConstants.cs
- DesignerActionMethodItem.cs
- HttpCacheVaryByContentEncodings.cs
- SrgsRulesCollection.cs
- SqlMethodTransformer.cs
- DirectoryInfo.cs
- FixedSOMImage.cs
- DataObjectMethodAttribute.cs
- MostlySingletonList.cs
- DetailsViewDesigner.cs
- FormsAuthenticationUser.cs
- XamlPathDataSerializer.cs
- Misc.cs
- DuplexClientBase.cs
- DataBoundControlAdapter.cs
- EndpointPerformanceCounters.cs
- TemplateFactory.cs
- Size.cs
- IisTraceListener.cs
- ThreadSafeList.cs
- XPathExpr.cs
- ToolstripProfessionalRenderer.cs
- CreatingCookieEventArgs.cs
- DaylightTime.cs
- TreeNodeCollectionEditor.cs
- UriTemplateLiteralPathSegment.cs
- NullableDecimalSumAggregationOperator.cs
- GlobalizationSection.cs
- BufferModeSettings.cs
- SchemaInfo.cs
- HttpProxyTransportBindingElement.cs
- ExpressionBuilderCollection.cs
- RelativeSource.cs
- UpdatePanelTrigger.cs
- MemberAccessException.cs
- RadioButton.cs
- XPathNavigatorKeyComparer.cs
- UriTemplateQueryValue.cs
- behaviorssection.cs
- HuffCodec.cs
- DocumentSequenceHighlightLayer.cs
- GridView.cs