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
- MenuAdapter.cs
- IsolatedStorageFilePermission.cs
- SynchronizationLockException.cs
- FreezableDefaultValueFactory.cs
- StickyNote.cs
- FormViewDeleteEventArgs.cs
- Brush.cs
- FixedTextBuilder.cs
- SystemUnicastIPAddressInformation.cs
- ConfigXmlComment.cs
- XmlAttributeAttribute.cs
- TextAutomationPeer.cs
- SoapFault.cs
- TaskForm.cs
- HyperLink.cs
- XmlNodeChangedEventManager.cs
- SuppressMessageAttribute.cs
- ColorConverter.cs
- DirectoryObjectSecurity.cs
- CompletedAsyncResult.cs
- ColumnResizeUndoUnit.cs
- SpeechSeg.cs
- BrowserCapabilitiesCodeGenerator.cs
- MasterPage.cs
- TraceListener.cs
- HybridCollection.cs
- VirtualPathProvider.cs
- MemberInitExpression.cs
- CompoundFileIOPermission.cs
- ColumnBinding.cs
- CmsUtils.cs
- ConfigurationConverterBase.cs
- AccessedThroughPropertyAttribute.cs
- TypedTableGenerator.cs
- ControlCachePolicy.cs
- ResourcesBuildProvider.cs
- TextTreeDeleteContentUndoUnit.cs
- ShapingWorkspace.cs
- DoubleCollectionConverter.cs
- SafeNativeMethods.cs
- FormViewCommandEventArgs.cs
- EnvelopedSignatureTransform.cs
- ListViewContainer.cs
- RadialGradientBrush.cs
- SecurityKeyEntropyMode.cs
- SqlAliaser.cs
- QueryExpression.cs
- Color.cs
- StylusDevice.cs
- PackWebRequestFactory.cs
- EventLogException.cs
- KeyGesture.cs
- ToolStripDropDownItem.cs
- DependencyObjectType.cs
- Ipv6Element.cs
- HtmlForm.cs
- ConcurrentStack.cs
- CodeNamespaceImportCollection.cs
- RepeatBehavior.cs
- BindingObserver.cs
- UniqueCodeIdentifierScope.cs
- SimpleType.cs
- DelegateSerializationHolder.cs
- FormViewUpdateEventArgs.cs
- ConfigurationFileMap.cs
- ColorTransform.cs
- SettingsPropertyWrongTypeException.cs
- Ops.cs
- GenericXmlSecurityToken.cs
- ContentElementAutomationPeer.cs
- SemaphoreSecurity.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- SecUtil.cs
- ActionMessageFilterTable.cs
- Image.cs
- TagMapCollection.cs
- LocalizationParserHooks.cs
- DefaultProxySection.cs
- ProcessHost.cs
- CountdownEvent.cs
- PerformanceCounterPermissionEntry.cs
- XmlSchemaInferenceException.cs
- ProtocolsConfigurationEntry.cs
- Funcletizer.cs
- XmlIlVisitor.cs
- RawStylusActions.cs
- PerformanceCounterPermission.cs
- CharacterBufferReference.cs
- WebPartZone.cs
- Part.cs
- ThreadStartException.cs
- TextWriter.cs
- SpellerInterop.cs
- DataGridItemCollection.cs
- AutoResizedEvent.cs
- HttpContext.cs
- BrushMappingModeValidation.cs
- PreviewKeyDownEventArgs.cs
- Control.cs