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
- GeometryGroup.cs
- DataColumnCollection.cs
- XmlNavigatorStack.cs
- WebServiceParameterData.cs
- CodeTypeMember.cs
- AnnotationService.cs
- AssemblyNameUtility.cs
- MarkupWriter.cs
- PhysicalOps.cs
- Profiler.cs
- VirtualPathUtility.cs
- WindowsAuthenticationEventArgs.cs
- CodeDOMUtility.cs
- UIElementPropertyUndoUnit.cs
- RectAnimationUsingKeyFrames.cs
- Rotation3DAnimation.cs
- BitmapEffect.cs
- RowVisual.cs
- NativeWindow.cs
- Int32CollectionValueSerializer.cs
- MetafileHeader.cs
- SQLBinaryStorage.cs
- MappingMetadataHelper.cs
- DbProviderManifest.cs
- SettingsProviderCollection.cs
- BitmapCodecInfoInternal.cs
- IsolatedStoragePermission.cs
- PrintPreviewGraphics.cs
- BinHexDecoder.cs
- FixedDocument.cs
- HtmlValidatorAdapter.cs
- FixedHighlight.cs
- TextServicesDisplayAttribute.cs
- StreamWriter.cs
- ChannelSinkStacks.cs
- SelectionRangeConverter.cs
- IdnMapping.cs
- IdentifierCollection.cs
- ScaleTransform3D.cs
- ReferencedCollectionType.cs
- Annotation.cs
- _SingleItemRequestCache.cs
- SerializerDescriptor.cs
- Component.cs
- IItemContainerGenerator.cs
- ToolbarAUtomationPeer.cs
- FontDialog.cs
- CellTreeNode.cs
- TypeExtension.cs
- WsatServiceCertificate.cs
- RadioButtonDesigner.cs
- XmlElementAttribute.cs
- SerializableAttribute.cs
- ProviderCommandInfoUtils.cs
- StringUtil.cs
- LambdaCompiler.ControlFlow.cs
- SeekStoryboard.cs
- SubqueryRules.cs
- SiteOfOriginPart.cs
- DataAccessor.cs
- DataGridViewButtonColumn.cs
- XmlSchemaAll.cs
- TypeDescriptionProviderAttribute.cs
- BitmapEffectInputData.cs
- PenThreadWorker.cs
- NetworkInterface.cs
- OdbcCommand.cs
- Keyboard.cs
- DelayedRegex.cs
- HttpValueCollection.cs
- DataObject.cs
- QueryServiceConfigHandle.cs
- PrinterResolution.cs
- DbReferenceCollection.cs
- PinnedBufferMemoryStream.cs
- StringOutput.cs
- BitmapEffectOutputConnector.cs
- mactripleDES.cs
- SchemaNotation.cs
- UrlAuthorizationModule.cs
- XmlQualifiedNameTest.cs
- DataGridViewCellParsingEventArgs.cs
- PointCollectionValueSerializer.cs
- handlecollector.cs
- ImmutableObjectAttribute.cs
- SelectionProcessor.cs
- TemplateParser.cs
- EdmComplexPropertyAttribute.cs
- MissingManifestResourceException.cs
- ImpersonateTokenRef.cs
- FieldMetadata.cs
- TrustLevel.cs
- HandleExceptionArgs.cs
- MaskedTextBox.cs
- DayRenderEvent.cs
- AppDomainAttributes.cs
- AttributeEmitter.cs
- ComMethodElement.cs
- GenericQueueSurrogate.cs
- TimeSpan.cs