Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / 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 = DefinitionProperties.GetUid(owner); 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
- SaveFileDialog.cs
- sqlstateclientmanager.cs
- SecurityCookieModeValidator.cs
- CompilationRelaxations.cs
- OpenTypeCommon.cs
- DefaultExpressionVisitor.cs
- XmlAttributeCache.cs
- BitmapEffectDrawingContent.cs
- HtmlControl.cs
- SqlDependencyUtils.cs
- Function.cs
- DesignerView.xaml.cs
- RepeaterCommandEventArgs.cs
- Quaternion.cs
- GregorianCalendarHelper.cs
- Parameter.cs
- GlyphTypeface.cs
- CellParagraph.cs
- FamilyTypeface.cs
- XmlArrayAttribute.cs
- EntityDataSourceState.cs
- SerializationEventsCache.cs
- BoolExpr.cs
- TaiwanLunisolarCalendar.cs
- DataControlImageButton.cs
- DataMemberFieldConverter.cs
- ExpressionsCollectionEditor.cs
- GroupBoxRenderer.cs
- ScrollItemPatternIdentifiers.cs
- PageParser.cs
- RSAPKCS1KeyExchangeFormatter.cs
- BinaryExpression.cs
- UserControl.cs
- EnvironmentPermission.cs
- WriterOutput.cs
- SafeProcessHandle.cs
- EventMappingSettingsCollection.cs
- LinearKeyFrames.cs
- BindingCollection.cs
- WsdlInspector.cs
- EntityContainer.cs
- XslNumber.cs
- TextFormatter.cs
- MeshGeometry3D.cs
- SqlSelectStatement.cs
- X509Certificate2Collection.cs
- EntryWrittenEventArgs.cs
- ContentElementCollection.cs
- RemotingServices.cs
- DesignerSerializerAttribute.cs
- UInt32Converter.cs
- AxParameterData.cs
- ValueType.cs
- PropertyMetadata.cs
- StrokeRenderer.cs
- AlternateView.cs
- PaintValueEventArgs.cs
- WebControl.cs
- Image.cs
- EqualityComparer.cs
- XmlSchemaValidator.cs
- BindingMAnagerBase.cs
- ProjectionPlan.cs
- WebPartConnectionCollection.cs
- CqlIdentifiers.cs
- KnowledgeBase.cs
- ToggleButton.cs
- ELinqQueryState.cs
- StrokeNodeOperations2.cs
- TemplatedMailWebEventProvider.cs
- NotSupportedException.cs
- TemplateField.cs
- DataBinder.cs
- Parameter.cs
- SchemaElementDecl.cs
- ConnectionPoint.cs
- ReferentialConstraint.cs
- GenericPrincipal.cs
- BamlRecords.cs
- MetafileHeader.cs
- EditingMode.cs
- WorkflowDesignerMessageFilter.cs
- coordinator.cs
- GridViewCommandEventArgs.cs
- X509SecurityToken.cs
- XmlTextEncoder.cs
- TableCell.cs
- ReachDocumentPageSerializerAsync.cs
- SettingsAttributeDictionary.cs
- SmtpNegotiateAuthenticationModule.cs
- NaturalLanguageHyphenator.cs
- GlyphRun.cs
- JsonDeserializer.cs
- XhtmlBasicCalendarAdapter.cs
- EllipticalNodeOperations.cs
- XmlUtil.cs
- DesignerWithHeader.cs
- RequestCacheManager.cs
- SpecialFolderEnumConverter.cs
- Context.cs