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
- SecurityIdentifierElementCollection.cs
- PassportAuthenticationEventArgs.cs
- SchemaObjectWriter.cs
- BookmarkEventArgs.cs
- XmlDownloadManager.cs
- UserControlBuildProvider.cs
- DataGridRelationshipRow.cs
- BypassElement.cs
- FreezableCollection.cs
- SafeEventLogWriteHandle.cs
- XmlReaderDelegator.cs
- SubqueryRules.cs
- VisualCollection.cs
- ObjectManager.cs
- EntityKeyElement.cs
- Button.cs
- PropertyKey.cs
- LineInfo.cs
- RegexRunnerFactory.cs
- InlineUIContainer.cs
- FixedSOMLineRanges.cs
- CaseStatement.cs
- LabelLiteral.cs
- DataDocumentXPathNavigator.cs
- ResourceDisplayNameAttribute.cs
- ButtonChrome.cs
- DynamicILGenerator.cs
- HealthMonitoringSectionHelper.cs
- TableLayoutColumnStyleCollection.cs
- PermissionSetTriple.cs
- RowUpdatedEventArgs.cs
- TypeLibConverter.cs
- SettingsPropertyIsReadOnlyException.cs
- TextDecorations.cs
- ViewCellRelation.cs
- WorkflowOperationAsyncResult.cs
- DBSqlParser.cs
- CommandValueSerializer.cs
- Thickness.cs
- Span.cs
- ResourcesBuildProvider.cs
- MustUnderstandSoapException.cs
- TemplateBamlRecordReader.cs
- XPathDocumentNavigator.cs
- MergeFilterQuery.cs
- CallSite.cs
- TCEAdapterGenerator.cs
- PolyLineSegment.cs
- Trace.cs
- HttpListener.cs
- OrderByQueryOptionExpression.cs
- isolationinterop.cs
- GlobalEventManager.cs
- DurationConverter.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- infer.cs
- DBAsyncResult.cs
- WebContext.cs
- CodeDOMUtility.cs
- PerformanceCounterManager.cs
- RSAPKCS1SignatureDeformatter.cs
- MatcherBuilder.cs
- ADConnectionHelper.cs
- ClientUtils.cs
- COAUTHINFO.cs
- GeneralTransformGroup.cs
- TypeUtil.cs
- EventLogPermissionEntry.cs
- manifestimages.cs
- Exceptions.cs
- LinqDataView.cs
- CounterSample.cs
- PersistenceProvider.cs
- CodeDomConfigurationHandler.cs
- IApplicationTrustManager.cs
- GridProviderWrapper.cs
- ObjectConverter.cs
- XmlExtensionFunction.cs
- DynamicResourceExtensionConverter.cs
- RemoteWebConfigurationHostServer.cs
- List.cs
- DataPager.cs
- TTSVoice.cs
- ConnectionDemuxer.cs
- TableColumn.cs
- PassportAuthenticationEventArgs.cs
- MatrixCamera.cs
- DbSetClause.cs
- BamlTreeNode.cs
- EngineSiteSapi.cs
- DataGridViewButtonColumn.cs
- OdbcConnectionFactory.cs
- WebSysDescriptionAttribute.cs
- ModifiableIteratorCollection.cs
- ReflectPropertyDescriptor.cs
- DataGridViewSelectedRowCollection.cs
- CollectionCodeDomSerializer.cs
- InvokeCompletedEventArgs.cs
- InProcStateClientManager.cs
- StandardToolWindows.cs