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 / HyperlinkAutomationPeer.cs / 1 / HyperlinkAutomationPeer.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// File: HyperlinkAutomationPeer.cs
//
// Description: Automation peer for hyperlink
//
//---------------------------------------------------------------------------
using System.Windows.Automation.Provider; // IRawElementProviderSimple
using System.Windows.Documents;
namespace System.Windows.Automation.Peers
{
///
public class HyperlinkAutomationPeer : TextElementAutomationPeer, IInvokeProvider
{
///
public HyperlinkAutomationPeer(Hyperlink owner)
: base(owner)
{ }
///
///
///
///
///
public override object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.Invoke)
{
return this;
}
return null;
}
//Default Automation properties
///
protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Hyperlink;
}
///
///
///
protected override string GetNameCore()
{
string name = base.GetNameCore();
if (name == string.Empty)
{
Hyperlink owner = (Hyperlink)Owner;
name = owner.Text;
if (name == null)
name = string.Empty;
}
return name;
}
///
override protected string GetClassNameCore()
{
return "Hyperlink";
}
///
///
///
override protected bool IsControlElementCore()
{
return true;
}
//Invoke Pattern implementation
void IInvokeProvider.Invoke()
{
if (!IsEnabled())
throw new ElementNotEnabledException();
Hyperlink owner = (Hyperlink)Owner;
owner.DoClick();
}
}
}
// 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: HyperlinkAutomationPeer.cs
//
// Description: Automation peer for hyperlink
//
//---------------------------------------------------------------------------
using System.Windows.Automation.Provider; // IRawElementProviderSimple
using System.Windows.Documents;
namespace System.Windows.Automation.Peers
{
///
public class HyperlinkAutomationPeer : TextElementAutomationPeer, IInvokeProvider
{
///
public HyperlinkAutomationPeer(Hyperlink owner)
: base(owner)
{ }
///
///
///
///
///
public override object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.Invoke)
{
return this;
}
return null;
}
//Default Automation properties
///
protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Hyperlink;
}
///
///
///
protected override string GetNameCore()
{
string name = base.GetNameCore();
if (name == string.Empty)
{
Hyperlink owner = (Hyperlink)Owner;
name = owner.Text;
if (name == null)
name = string.Empty;
}
return name;
}
///
override protected string GetClassNameCore()
{
return "Hyperlink";
}
///
///
///
override protected bool IsControlElementCore()
{
return true;
}
//Invoke Pattern implementation
void IInvokeProvider.Invoke()
{
if (!IsEnabled())
throw new ElementNotEnabledException();
Hyperlink owner = (Hyperlink)Owner;
owner.DoClick();
}
}
}
// 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
- SelectorAutomationPeer.cs
- WsdlInspector.cs
- OleAutBinder.cs
- NeedSkipTokenVisitor.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- CompareValidator.cs
- WebRequest.cs
- X509CertificateValidator.cs
- LostFocusEventManager.cs
- TextElementAutomationPeer.cs
- StructuralObject.cs
- TextParaLineResult.cs
- VBIdentifierName.cs
- HttpCachePolicy.cs
- OleDbErrorCollection.cs
- SafeNativeMethodsMilCoreApi.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- RangeValidator.cs
- ScaleTransform3D.cs
- Point3D.cs
- MetadataExporter.cs
- ErrorHandler.cs
- updateconfighost.cs
- Annotation.cs
- RangeValueProviderWrapper.cs
- DoubleStorage.cs
- CFStream.cs
- LabelTarget.cs
- EntityDataSourceWrapperCollection.cs
- HTMLTagNameToTypeMapper.cs
- SqlBooleanMismatchVisitor.cs
- MenuTracker.cs
- WindowsContainer.cs
- serverconfig.cs
- PhoneCall.cs
- DataProtection.cs
- Region.cs
- CharUnicodeInfo.cs
- ComPlusInstanceProvider.cs
- TextCompositionManager.cs
- TargetInvocationException.cs
- XmlDigitalSignatureProcessor.cs
- WindowsTitleBar.cs
- RC2.cs
- DeferredReference.cs
- DateBoldEvent.cs
- ZeroOpNode.cs
- QueryStringParameter.cs
- FixedSOMTable.cs
- AutomationTextAttribute.cs
- SQLRoleProvider.cs
- ItemsPresenter.cs
- PropertyValueUIItem.cs
- LogicalExpr.cs
- CheckBoxList.cs
- BCLDebug.cs
- DynamicResourceExtension.cs
- IDispatchConstantAttribute.cs
- ObjectConverter.cs
- ErrorRuntimeConfig.cs
- OracleConnectionFactory.cs
- SafeBitVector32.cs
- bidPrivateBase.cs
- EncodingDataItem.cs
- ComplexObject.cs
- AsyncOperation.cs
- SchemaImporterExtensionElementCollection.cs
- GeometryConverter.cs
- EmptyImpersonationContext.cs
- login.cs
- LoadWorkflowByKeyAsyncResult.cs
- shaperfactoryquerycachekey.cs
- XmlWrappingReader.cs
- LinqExpressionNormalizer.cs
- CancellationToken.cs
- TextEffectResolver.cs
- ProviderConnectionPoint.cs
- DataPagerFieldCollection.cs
- MessageDroppedTraceRecord.cs
- PerformanceCounters.cs
- TableCellCollection.cs
- ListBoxChrome.cs
- CodeMemberMethod.cs
- odbcmetadatacolumnnames.cs
- IncomingWebRequestContext.cs
- BoundField.cs
- GridPattern.cs
- SerializationInfo.cs
- SimpleFileLog.cs
- LinearQuaternionKeyFrame.cs
- ZipIOModeEnforcingStream.cs
- MDIControlStrip.cs
- SynchronizationContext.cs
- CategoryNameCollection.cs
- XmlElementAttribute.cs
- IndexOutOfRangeException.cs
- TaskSchedulerException.cs
- NetStream.cs
- MenuBindingsEditor.cs
- SqlError.cs