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 / FrameworkContentElementAutomationPeer.cs / 1 / FrameworkContentElementAutomationPeer.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// File: FrameworkContentElementAutomationPeer.cs
//
// Description: AutomationPeer associated with FrameworkContnetElement.
//
//---------------------------------------------------------------------------
using System.Windows.Markup; // DefinitionProperties
using System.Windows.Controls; // Label
namespace System.Windows.Automation.Peers
{
///
/// AutomationPeer associated with FrameworkContentElement.
///
public class FrameworkContentElementAutomationPeer : ContentElementAutomationPeer
{
///
/// Constructor.
///
/// Owner of the AutomationPeer.
public FrameworkContentElementAutomationPeer(FrameworkContentElement owner)
: base(owner)
{ }
///
///
///
protected override string GetAutomationIdCore()
{
// 1. fetch AutomationProperties.AutomationIdProperty
string result = base.GetAutomationIdCore();
if (string.IsNullOrEmpty(result))
{
// 2. fetch x:Uid
// Uid's do not appear on content elements.
// result = DefinitionProperties.GetUid(Owner);
if (string.IsNullOrEmpty(result))
{
// 3. fetch FrameworkElement.NameProperty
result = ((FrameworkContentElement)Owner).Name;
}
}
return result == null ? string.Empty : result;
}
///
protected override string GetHelpTextCore()
{
string result = base.GetHelpTextCore();
if (string.IsNullOrEmpty(result))
{
object toolTip = ((FrameworkContentElement)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.
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// File: FrameworkContentElementAutomationPeer.cs
//
// Description: AutomationPeer associated with FrameworkContnetElement.
//
//---------------------------------------------------------------------------
using System.Windows.Markup; // DefinitionProperties
using System.Windows.Controls; // Label
namespace System.Windows.Automation.Peers
{
///
/// AutomationPeer associated with FrameworkContentElement.
///
public class FrameworkContentElementAutomationPeer : ContentElementAutomationPeer
{
///
/// Constructor.
///
/// Owner of the AutomationPeer.
public FrameworkContentElementAutomationPeer(FrameworkContentElement owner)
: base(owner)
{ }
///
///
///
protected override string GetAutomationIdCore()
{
// 1. fetch AutomationProperties.AutomationIdProperty
string result = base.GetAutomationIdCore();
if (string.IsNullOrEmpty(result))
{
// 2. fetch x:Uid
// Uid's do not appear on content elements.
// result = DefinitionProperties.GetUid(Owner);
if (string.IsNullOrEmpty(result))
{
// 3. fetch FrameworkElement.NameProperty
result = ((FrameworkContentElement)Owner).Name;
}
}
return result == null ? string.Empty : result;
}
///
protected override string GetHelpTextCore()
{
string result = base.GetHelpTextCore();
if (string.IsNullOrEmpty(result))
{
object toolTip = ((FrameworkContentElement)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
- Camera.cs
- CompositeDataBoundControl.cs
- OdbcParameter.cs
- ToolStripDropDown.cs
- HtmlMobileTextWriter.cs
- DefaultEventAttribute.cs
- EqualityComparer.cs
- WebCategoryAttribute.cs
- SmtpDigestAuthenticationModule.cs
- ToolBarTray.cs
- PropertyGridEditorPart.cs
- NamespaceInfo.cs
- SafeFileMappingHandle.cs
- Size3DValueSerializer.cs
- ActivityStateQuery.cs
- DbProviderServices.cs
- ResponseStream.cs
- InstallerTypeAttribute.cs
- TypeGeneratedEventArgs.cs
- BigInt.cs
- SqlCacheDependencyDatabaseCollection.cs
- ResourcePermissionBaseEntry.cs
- XmlUnspecifiedAttribute.cs
- FtpRequestCacheValidator.cs
- _ListenerResponseStream.cs
- XmlRootAttribute.cs
- TextBlock.cs
- RecordsAffectedEventArgs.cs
- input.cs
- DataGridRelationshipRow.cs
- LinearKeyFrames.cs
- PeerEndPoint.cs
- ParenthesizePropertyNameAttribute.cs
- PhonemeConverter.cs
- TreeViewEvent.cs
- EndOfStreamException.cs
- BufferBuilder.cs
- PrintDialog.cs
- DataGridViewRowHeaderCell.cs
- IPHostEntry.cs
- CaseInsensitiveComparer.cs
- CurrentChangingEventArgs.cs
- Int64AnimationUsingKeyFrames.cs
- EventSinkHelperWriter.cs
- HtmlButton.cs
- MouseActionConverter.cs
- CodeDelegateInvokeExpression.cs
- ValueTable.cs
- RemotingConfigParser.cs
- ArraySortHelper.cs
- SettingsBindableAttribute.cs
- ExceptionTrace.cs
- CodeArgumentReferenceExpression.cs
- FlowchartDesignerCommands.cs
- ClientSettings.cs
- SQLMoneyStorage.cs
- RootAction.cs
- ErrorProvider.cs
- storepermissionattribute.cs
- TypeInfo.cs
- HtmlTableRow.cs
- COM2IDispatchConverter.cs
- DataGridViewTextBoxColumn.cs
- LinqDataSourceSelectEventArgs.cs
- OrderedDictionaryStateHelper.cs
- TrackingDataItem.cs
- ServiceDesigner.xaml.cs
- XamlParser.cs
- ChangePassword.cs
- ParentUndoUnit.cs
- WizardDesigner.cs
- BuildResult.cs
- XmlCDATASection.cs
- TextRangeBase.cs
- InkPresenterAutomationPeer.cs
- SchemaElementLookUpTableEnumerator.cs
- ArrayList.cs
- BindingList.cs
- EdmItemCollection.OcAssemblyCache.cs
- StaticFileHandler.cs
- TextHidden.cs
- AuthorizationRule.cs
- PeerTransportListenAddressConverter.cs
- UriScheme.cs
- MessageVersionConverter.cs
- Attributes.cs
- PerformanceCounterPermissionAttribute.cs
- SafeSecurityHelper.cs
- BaseCodePageEncoding.cs
- TypeListConverter.cs
- CompositeFontInfo.cs
- ScrollEventArgs.cs
- DispatcherTimer.cs
- DrawingContextWalker.cs
- OperatingSystem.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- DataGridViewBindingCompleteEventArgs.cs
- WebBaseEventKeyComparer.cs
- IdentityHolder.cs
- RoleBoolean.cs