Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Automation / Peers / FrameworkElementAutomationPeer.cs / 1 / 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
- GeneratedCodeAttribute.cs
- OneWayBindingElement.cs
- XslException.cs
- HtmlShimManager.cs
- DataGridViewToolTip.cs
- VSDExceptions.cs
- ToggleProviderWrapper.cs
- SolidColorBrush.cs
- InplaceBitmapMetadataWriter.cs
- Rect3D.cs
- WebPartZoneBase.cs
- FixedFlowMap.cs
- AllMembershipCondition.cs
- SelectionListComponentEditor.cs
- DesignerVerbCollection.cs
- MemberPath.cs
- CFStream.cs
- SqlUnionizer.cs
- DataViewSettingCollection.cs
- TimeEnumHelper.cs
- TypeGeneratedEventArgs.cs
- MobileUserControlDesigner.cs
- SafeNativeMethods.cs
- SimpleApplicationHost.cs
- DependencyPropertyKind.cs
- FixedTextBuilder.cs
- Activator.cs
- CodeMethodReturnStatement.cs
- DependencyObjectValidator.cs
- FunctionNode.cs
- HttpProtocolImporter.cs
- httpserverutility.cs
- PasswordPropertyTextAttribute.cs
- InstanceDataCollection.cs
- InfiniteTimeSpanConverter.cs
- PostBackOptions.cs
- ListViewItemMouseHoverEvent.cs
- ListControlStringCollectionEditor.cs
- ImageMapEventArgs.cs
- MailMessageEventArgs.cs
- SemaphoreFullException.cs
- UnionCqlBlock.cs
- CreateRefExpr.cs
- Models.cs
- GenerateTemporaryTargetAssembly.cs
- AccessDataSource.cs
- FileRegion.cs
- AccessViolationException.cs
- StructuralType.cs
- SqlDataSourceCommandEventArgs.cs
- UnmanagedMarshal.cs
- GeneratedView.cs
- PtsContext.cs
- OperatingSystem.cs
- CultureTable.cs
- RootContext.cs
- SamlAttribute.cs
- DateTimeConverter2.cs
- WorkflowOperationAsyncResult.cs
- HtmlLinkAdapter.cs
- KeyNameIdentifierClause.cs
- PartManifestEntry.cs
- DataGridRow.cs
- InternalConfigConfigurationFactory.cs
- ModuleElement.cs
- XmlDictionaryString.cs
- AnyReturnReader.cs
- TreeNode.cs
- OleDbParameter.cs
- ToolStripMenuItem.cs
- SinglePhaseEnlistment.cs
- ListViewItem.cs
- CustomCredentialPolicy.cs
- InvalidComObjectException.cs
- Sequence.cs
- filewebrequest.cs
- ClassicBorderDecorator.cs
- FormViewCommandEventArgs.cs
- UrlRoutingHandler.cs
- UIElementHelper.cs
- OleDbFactory.cs
- LOSFormatter.cs
- ControlParameter.cs
- ContentIterators.cs
- FixedSOMContainer.cs
- XmlSerializerFaultFormatter.cs
- CompoundFileReference.cs
- SqlStream.cs
- COM2ExtendedTypeConverter.cs
- FontStretchConverter.cs
- SqlUdtInfo.cs
- HtmlInputControl.cs
- OperationAbortedException.cs
- MailMessage.cs
- cache.cs
- DataSourceConverter.cs
- SkewTransform.cs
- SiblingIterators.cs
- ProgressBarBrushConverter.cs
- SubMenuStyleCollection.cs