Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- X509ScopedServiceCertificateElement.cs
- UncommonField.cs
- MasterPageParser.cs
- AuthenticateEventArgs.cs
- TextOnlyOutput.cs
- SystemNetworkInterface.cs
- FlowDocument.cs
- CompositeCollection.cs
- HwndStylusInputProvider.cs
- InputManager.cs
- Reference.cs
- WebContext.cs
- PageBorderless.cs
- DesigntimeLicenseContextSerializer.cs
- ActivityDesigner.cs
- SafeNativeMethods.cs
- CompositeDesignerAccessibleObject.cs
- SecurityTokenAuthenticator.cs
- Hash.cs
- SecurityRuntime.cs
- Annotation.cs
- Boolean.cs
- XmlSchemaAttributeGroupRef.cs
- ProcessModelInfo.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- propertytag.cs
- DataGridHeaderBorder.cs
- StylusButtonCollection.cs
- MLangCodePageEncoding.cs
- InitializationEventAttribute.cs
- AutomationEventArgs.cs
- Process.cs
- EntityTransaction.cs
- ObservableCollection.cs
- XmlValidatingReaderImpl.cs
- ItemsControlAutomationPeer.cs
- OrthographicCamera.cs
- XmlQualifiedName.cs
- HwndSource.cs
- NativeActivityMetadata.cs
- ConversionContext.cs
- WizardForm.cs
- CompoundFileReference.cs
- SqlUtils.cs
- Root.cs
- Baml2006SchemaContext.cs
- Native.cs
- DBCSCodePageEncoding.cs
- ExtendedPropertyInfo.cs
- FilterableAttribute.cs
- SimpleFieldTemplateFactory.cs
- DashStyles.cs
- ColumnResult.cs
- XDRSchema.cs
- OpenTypeLayout.cs
- SettingsPropertyValueCollection.cs
- Bezier.cs
- ToolStripScrollButton.cs
- Page.cs
- QueryAsyncResult.cs
- CommonDialog.cs
- DataSourceProvider.cs
- HtmlControlPersistable.cs
- BreakRecordTable.cs
- AdapterDictionary.cs
- ZipIOExtraFieldPaddingElement.cs
- DbTypeMap.cs
- SymmetricAlgorithm.cs
- DataSetUtil.cs
- WSSecurityPolicy11.cs
- XmlSchemaGroup.cs
- XPathNodeIterator.cs
- ActivationServices.cs
- XmlSchemaDocumentation.cs
- Rfc2898DeriveBytes.cs
- ListArgumentProvider.cs
- SqlDelegatedTransaction.cs
- SystemNetworkInterface.cs
- XmlCharCheckingReader.cs
- WebPartDisplayModeEventArgs.cs
- GraphicsPath.cs
- TableLayoutPanelCellPosition.cs
- XmlSchemaComplexContentExtension.cs
- DBDataPermission.cs
- BinaryMessageFormatter.cs
- ExtensionFile.cs
- ServiceNameElement.cs
- Vars.cs
- ToolStripStatusLabel.cs
- StylusPointPropertyUnit.cs
- MessageDescription.cs
- InputMethod.cs
- ImageCodecInfo.cs
- behaviorssection.cs
- _FtpDataStream.cs
- XPathSingletonIterator.cs
- XmlSerializerSection.cs
- AsnEncodedData.cs
- DateTimeUtil.cs
- Freezable.cs