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
- SqlTriggerAttribute.cs
- MethodBuilder.cs
- ButtonChrome.cs
- StatusBarItemAutomationPeer.cs
- CriticalHandle.cs
- DataBindingList.cs
- VariableQuery.cs
- GraphicsPathIterator.cs
- FontStyleConverter.cs
- SQlBooleanStorage.cs
- MinimizableAttributeTypeConverter.cs
- CounterSample.cs
- XPathSelfQuery.cs
- PointLight.cs
- SslStreamSecurityBindingElement.cs
- ConstructorArgumentAttribute.cs
- ImageFormat.cs
- BeginStoryboard.cs
- StateManagedCollection.cs
- AsyncDataRequest.cs
- WebPartConnectionsDisconnectVerb.cs
- ModuleBuilder.cs
- AppDomain.cs
- HtmlTableCellCollection.cs
- DecoderFallback.cs
- IItemProperties.cs
- Margins.cs
- DrawingVisual.cs
- NumericUpDownAccelerationCollection.cs
- RoutedEventHandlerInfo.cs
- DocumentXPathNavigator.cs
- SecurityPolicySection.cs
- SqlMethods.cs
- LifetimeMonitor.cs
- GifBitmapDecoder.cs
- MatrixUtil.cs
- CancelEventArgs.cs
- SplineKeyFrames.cs
- Proxy.cs
- SqlDataSourceView.cs
- RegexFCD.cs
- BitmapEffectInput.cs
- newitemfactory.cs
- DataReceivedEventArgs.cs
- DataShape.cs
- _NegoStream.cs
- FieldDescriptor.cs
- XmlnsCache.cs
- ContextMenuAutomationPeer.cs
- PlanCompilerUtil.cs
- EdmTypeAttribute.cs
- HtmlCommandAdapter.cs
- DiscoveryClientProtocol.cs
- TemplateXamlTreeBuilder.cs
- COM2ExtendedUITypeEditor.cs
- StylusPointProperties.cs
- HttpValueCollection.cs
- PublisherMembershipCondition.cs
- TextAnchor.cs
- PagerSettings.cs
- MiniAssembly.cs
- DataGridComponentEditor.cs
- EncryptedType.cs
- StdValidatorsAndConverters.cs
- LocationUpdates.cs
- SymmetricCryptoHandle.cs
- AccessDataSourceView.cs
- ToolStripLabel.cs
- UpdateExpressionVisitor.cs
- PnrpPermission.cs
- DocumentCollection.cs
- DataGridViewCellValidatingEventArgs.cs
- Crc32.cs
- ReadOnlyDataSourceView.cs
- IPPacketInformation.cs
- ConnectionManagementSection.cs
- SingleObjectCollection.cs
- HuffmanTree.cs
- AsymmetricKeyExchangeDeformatter.cs
- JsonReader.cs
- EntityDataSourceContextCreatedEventArgs.cs
- ServiceAuthorizationElement.cs
- NativeMethods.cs
- PassportAuthenticationEventArgs.cs
- HandledEventArgs.cs
- MsmqIntegrationOutputChannel.cs
- AutoResetEvent.cs
- WebPartsPersonalization.cs
- Flowchart.cs
- ToolStripPanelRow.cs
- MultiPageTextView.cs
- ChangesetResponse.cs
- ErrorFormatterPage.cs
- RectValueSerializer.cs
- TemplateBindingExpression.cs
- XmlSerializerSection.cs
- HttpVersion.cs
- DeclarativeExpressionConditionDeclaration.cs
- InternalDuplexChannelListener.cs
- EnumerableRowCollection.cs