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
- DataGridDesigner.cs
- LocalizabilityAttribute.cs
- IndexingContentUnit.cs
- ScrollChangedEventArgs.cs
- OleAutBinder.cs
- ButtonBase.cs
- SqlProvider.cs
- WebUtil.cs
- TargetPerspective.cs
- DesignerSerializationVisibilityAttribute.cs
- XmlDataImplementation.cs
- FamilyMap.cs
- Pkcs7Recipient.cs
- XmlnsCache.cs
- GuidConverter.cs
- Unit.cs
- RoleManagerEventArgs.cs
- ConsoleTraceListener.cs
- ToolStripPanelSelectionBehavior.cs
- TextTabProperties.cs
- BamlReader.cs
- TransformCollection.cs
- ASCIIEncoding.cs
- iisPickupDirectory.cs
- InstanceData.cs
- DataBoundLiteralControl.cs
- DataTableReader.cs
- XslCompiledTransform.cs
- TlsnegoTokenProvider.cs
- COM2PropertyDescriptor.cs
- ReliableMessagingVersionConverter.cs
- StrokeCollectionConverter.cs
- RequestCacheEntry.cs
- RegexReplacement.cs
- RelatedImageListAttribute.cs
- AggregateException.cs
- StringAnimationUsingKeyFrames.cs
- Validator.cs
- SystemEvents.cs
- RankException.cs
- HashMembershipCondition.cs
- SafeSecurityHandles.cs
- ReadWriteControlDesigner.cs
- AutomationPropertyInfo.cs
- XmlSerializerOperationFormatter.cs
- ParserContext.cs
- BoolExpr.cs
- BinaryNode.cs
- LinearQuaternionKeyFrame.cs
- CngKeyCreationParameters.cs
- AncestorChangedEventArgs.cs
- Tokenizer.cs
- ActiveXHelper.cs
- PlaceHolder.cs
- TraceLog.cs
- HMAC.cs
- ExpressionsCollectionConverter.cs
- BufferedGraphicsManager.cs
- DBParameter.cs
- Pen.cs
- ClientApiGenerator.cs
- ReachUIElementCollectionSerializerAsync.cs
- ListenerElementsCollection.cs
- ListChangedEventArgs.cs
- AsyncContentLoadedEventArgs.cs
- Compiler.cs
- Message.cs
- SqlGatherProducedAliases.cs
- Image.cs
- WizardStepBase.cs
- CursorConverter.cs
- Color.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- ApplicationDirectoryMembershipCondition.cs
- ObjectHelper.cs
- Action.cs
- DirectoryObjectSecurity.cs
- DataGridColumnDropSeparator.cs
- sqlnorm.cs
- CancelEventArgs.cs
- BroadcastEventHelper.cs
- WorkItem.cs
- SortedDictionary.cs
- URLString.cs
- XmlSchemaGroupRef.cs
- ValidationSummary.cs
- PreviousTrackingServiceAttribute.cs
- RegexCharClass.cs
- Intellisense.cs
- ToolbarAUtomationPeer.cs
- DataList.cs
- RTLAwareMessageBox.cs
- PackWebRequest.cs
- Convert.cs
- NewArray.cs
- Int64Animation.cs
- XmlSchemaComplexContentExtension.cs
- LoginView.cs
- ViewStateModeByIdAttribute.cs
- EndpointIdentityConverter.cs