Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / FrameworkElementAutomationPeer.cs / 1305600 / 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; } } } // 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; } } } // 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
- SetMemberBinder.cs
- IndexedString.cs
- DataSourceComponent.cs
- SiteMapPath.cs
- Script.cs
- XslTransformFileEditor.cs
- FileDetails.cs
- DetailsViewDeletedEventArgs.cs
- Registry.cs
- StylusButtonEventArgs.cs
- TableColumnCollection.cs
- TemplateControl.cs
- UseManagedPresentationBindingElement.cs
- LongMinMaxAggregationOperator.cs
- RegexMatchCollection.cs
- FileChangesMonitor.cs
- EntitySqlException.cs
- Tuple.cs
- PackageStore.cs
- CommonEndpointBehaviorElement.cs
- UserControlBuildProvider.cs
- Accessors.cs
- DesignerCategoryAttribute.cs
- XmlResolver.cs
- DataServiceRequestArgs.cs
- WsdlContractConversionContext.cs
- AspCompat.cs
- CodeIdentifiers.cs
- PreparingEnlistment.cs
- DocobjHost.cs
- PresentationSource.cs
- CachedPathData.cs
- ExtensibleSyndicationObject.cs
- MILUtilities.cs
- SelectionList.cs
- DefaultAsyncDataDispatcher.cs
- Ref.cs
- XmlSchemaSimpleContent.cs
- WebColorConverter.cs
- XmlCountingReader.cs
- SchemaImporterExtensionElement.cs
- TextBlockAutomationPeer.cs
- EncodingDataItem.cs
- ClientTargetCollection.cs
- PointValueSerializer.cs
- OrderByQueryOptionExpression.cs
- TdsEnums.cs
- Simplifier.cs
- HtmlControlPersistable.cs
- WorkerRequest.cs
- PropertyGridCommands.cs
- Page.cs
- ListBoxAutomationPeer.cs
- XmlDomTextWriter.cs
- ObjectConverter.cs
- TabControl.cs
- Baml2006Reader.cs
- ElementProxy.cs
- FileLoadException.cs
- RuleSettingsCollection.cs
- IPPacketInformation.cs
- DataMisalignedException.cs
- ContentType.cs
- DesignerSerializerAttribute.cs
- ProfileModule.cs
- DataExpression.cs
- HtmlControl.cs
- TextBox.cs
- InvariantComparer.cs
- DataGridViewColumnHeaderCell.cs
- ProtocolViolationException.cs
- PageParser.cs
- TextBlock.cs
- CleanUpVirtualizedItemEventArgs.cs
- UriWriter.cs
- XmlSchemaImport.cs
- DelayLoadType.cs
- SqlConnectionFactory.cs
- ToolStripKeyboardHandlingService.cs
- ConnectionManagementSection.cs
- TreeNodeCollection.cs
- FilteredDataSetHelper.cs
- GenericTypeParameterBuilder.cs
- ResourceReferenceExpressionConverter.cs
- ConfigurationElementProperty.cs
- SessionState.cs
- SerializationFieldInfo.cs
- Baml6Assembly.cs
- ErrorView.xaml.cs
- DataServiceRequestArgs.cs
- RoutedCommand.cs
- GridToolTip.cs
- WindowsListViewGroupSubsetLink.cs
- XsdDataContractExporter.cs
- InkPresenterAutomationPeer.cs
- WpfXamlLoader.cs
- HttpCachePolicy.cs
- LinkClickEvent.cs
- ButtonRenderer.cs
- Base64Encoder.cs