Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Automation / Peers / ContentElementAutomationPeer.cs / 1 / ContentElementAutomationPeer.cs
//----------------------------------------------------------------------------
//
// File: ContentElementAutomationPeer.cs
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// Description: Automation element for ContentElements
//
//---------------------------------------------------------------------------
using System; // Object
using System.Collections.Generic; // List
using System.Windows.Input; // AccessKeyManager
using MS.Internal.PresentationCore; // SR
namespace System.Windows.Automation.Peers
{
///
public class ContentElementAutomationPeer : AutomationPeer
{
///
public ContentElementAutomationPeer(ContentElement owner)
{
if (owner == null)
{
throw new ArgumentNullException("owner");
}
_owner = owner;
}
///
public ContentElement Owner
{
get
{
return _owner;
}
}
///
/// This static helper creates an AutomationPeer for the specified element and
/// caches it - that means the created peer is going to live long and shadow the
/// element for its lifetime. The peer will be used by Automation to proxy the element, and
/// to fire events to the Automation when something happens with the element.
/// The created peer is returned from this method and also from subsequent calls to this method
/// and . The type of the peer is determined by the
/// virtual callback. If FrameworkContentElement does not
/// implement the callback, there will be no peer and this method will return 'null' (in other
/// words, there is no such thing as a 'default peer').
///
public static AutomationPeer CreatePeerForElement(ContentElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return element.CreateAutomationPeer();
}
///
public static AutomationPeer FromElement(ContentElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return element.GetAutomationPeer();
}
///
///
///
override protected List GetChildrenCore()
{
return null;
}
///
override public object GetPattern(PatternInterface patternInterface)
{
return null;
}
///
///
///
protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Custom;
}
///
///
///
protected override string GetAutomationIdCore()
{
return AutomationProperties.GetAutomationId(_owner);
}
///
///
///
protected override string GetNameCore()
{
return AutomationProperties.GetName(_owner);
}
///
///
///
protected override string GetHelpTextCore()
{
return AutomationProperties.GetHelpText(_owner);
}
///
///
///
override protected Rect GetBoundingRectangleCore()
{
return Rect.Empty;
}
///
///
///
override protected bool IsOffscreenCore()
{
return true;
}
///
///
///
override protected AutomationOrientation GetOrientationCore()
{
return AutomationOrientation.None;
}
///
///
///
override protected string GetItemTypeCore()
{
return string.Empty;
}
///
///
///
override protected string GetClassNameCore()
{
return string.Empty;
}
///
///
///
override protected string GetItemStatusCore()
{
return string.Empty;
}
///
///
///
override protected bool IsRequiredForFormCore()
{
return false;
}
///
///
///
override protected bool IsKeyboardFocusableCore()
{
return Keyboard.IsFocusable(_owner);
}
///
///
///
override protected bool HasKeyboardFocusCore()
{
return _owner.IsKeyboardFocused;
}
///
///
///
override protected bool IsEnabledCore()
{
return _owner.IsEnabled;
}
///
///
///
override protected bool IsPasswordCore()
{
return false;
}
///
///
///
override protected bool IsContentElementCore()
{
return true;
}
///
///
///
override protected bool IsControlElementCore()
{
return false;
}
///
///
///
override protected AutomationPeer GetLabeledByCore()
{
return null;
}
///
///
///
override protected string GetAcceleratorKeyCore()
{
return string.Empty;
}
///
///
///
override protected string GetAccessKeyCore()
{
return AccessKeyManager.InternalGetAccessKeyCharacter(_owner);
}
///
///
///
override protected Point GetClickablePointCore()
{
return new Point(double.NaN, double.NaN);
}
///
///
///
override protected void SetFocusCore()
{
if (!_owner.Focus())
throw new InvalidOperationException(SR.Get(SRID.SetFocusFailed));
}
private ContentElement _owner;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
// File: ContentElementAutomationPeer.cs
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// Description: Automation element for ContentElements
//
//---------------------------------------------------------------------------
using System; // Object
using System.Collections.Generic; // List
using System.Windows.Input; // AccessKeyManager
using MS.Internal.PresentationCore; // SR
namespace System.Windows.Automation.Peers
{
///
public class ContentElementAutomationPeer : AutomationPeer
{
///
public ContentElementAutomationPeer(ContentElement owner)
{
if (owner == null)
{
throw new ArgumentNullException("owner");
}
_owner = owner;
}
///
public ContentElement Owner
{
get
{
return _owner;
}
}
///
/// This static helper creates an AutomationPeer for the specified element and
/// caches it - that means the created peer is going to live long and shadow the
/// element for its lifetime. The peer will be used by Automation to proxy the element, and
/// to fire events to the Automation when something happens with the element.
/// The created peer is returned from this method and also from subsequent calls to this method
/// and . The type of the peer is determined by the
/// virtual callback. If FrameworkContentElement does not
/// implement the callback, there will be no peer and this method will return 'null' (in other
/// words, there is no such thing as a 'default peer').
///
public static AutomationPeer CreatePeerForElement(ContentElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return element.CreateAutomationPeer();
}
///
public static AutomationPeer FromElement(ContentElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return element.GetAutomationPeer();
}
///
///
///
override protected List GetChildrenCore()
{
return null;
}
///
override public object GetPattern(PatternInterface patternInterface)
{
return null;
}
///
///
///
protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Custom;
}
///
///
///
protected override string GetAutomationIdCore()
{
return AutomationProperties.GetAutomationId(_owner);
}
///
///
///
protected override string GetNameCore()
{
return AutomationProperties.GetName(_owner);
}
///
///
///
protected override string GetHelpTextCore()
{
return AutomationProperties.GetHelpText(_owner);
}
///
///
///
override protected Rect GetBoundingRectangleCore()
{
return Rect.Empty;
}
///
///
///
override protected bool IsOffscreenCore()
{
return true;
}
///
///
///
override protected AutomationOrientation GetOrientationCore()
{
return AutomationOrientation.None;
}
///
///
///
override protected string GetItemTypeCore()
{
return string.Empty;
}
///
///
///
override protected string GetClassNameCore()
{
return string.Empty;
}
///
///
///
override protected string GetItemStatusCore()
{
return string.Empty;
}
///
///
///
override protected bool IsRequiredForFormCore()
{
return false;
}
///
///
///
override protected bool IsKeyboardFocusableCore()
{
return Keyboard.IsFocusable(_owner);
}
///
///
///
override protected bool HasKeyboardFocusCore()
{
return _owner.IsKeyboardFocused;
}
///
///
///
override protected bool IsEnabledCore()
{
return _owner.IsEnabled;
}
///
///
///
override protected bool IsPasswordCore()
{
return false;
}
///
///
///
override protected bool IsContentElementCore()
{
return true;
}
///
///
///
override protected bool IsControlElementCore()
{
return false;
}
///
///
///
override protected AutomationPeer GetLabeledByCore()
{
return null;
}
///
///
///
override protected string GetAcceleratorKeyCore()
{
return string.Empty;
}
///
///
///
override protected string GetAccessKeyCore()
{
return AccessKeyManager.InternalGetAccessKeyCharacter(_owner);
}
///
///
///
override protected Point GetClickablePointCore()
{
return new Point(double.NaN, double.NaN);
}
///
///
///
override protected void SetFocusCore()
{
if (!_owner.Focus())
throw new InvalidOperationException(SR.Get(SRID.SetFocusFailed));
}
private ContentElement _owner;
}
}
// 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
- WindowsAltTab.cs
- FlowLayoutSettings.cs
- CollectionTraceRecord.cs
- GridViewEditEventArgs.cs
- DbConnectionPoolGroup.cs
- TdsValueSetter.cs
- Point3DIndependentAnimationStorage.cs
- XmlSchemaComplexType.cs
- TimeSpanConverter.cs
- SecurityUtils.cs
- Events.cs
- ErasingStroke.cs
- XmlNamespaceManager.cs
- Dump.cs
- XmlObjectSerializerContext.cs
- RtfToken.cs
- MediaContextNotificationWindow.cs
- BlurBitmapEffect.cs
- MenuItemBindingCollection.cs
- AdRotatorDesigner.cs
- SystemEvents.cs
- DataGridViewCellValueEventArgs.cs
- InputEventArgs.cs
- SystemTcpStatistics.cs
- RijndaelManaged.cs
- HttpModuleActionCollection.cs
- ObjectListSelectEventArgs.cs
- SMSvcHost.cs
- LayoutEditorPart.cs
- WindowsToolbar.cs
- CodeBinaryOperatorExpression.cs
- Point3DConverter.cs
- FixedPageStructure.cs
- System.Data_BID.cs
- XmlUtil.cs
- CodeBinaryOperatorExpression.cs
- ProcessStartInfo.cs
- ConditionalAttribute.cs
- HeaderUtility.cs
- IndexedEnumerable.cs
- TextServicesProperty.cs
- ContainerUIElement3D.cs
- XmlSerializerSection.cs
- ContainerSelectorActiveEvent.cs
- Baml6Assembly.cs
- SQLString.cs
- OracleBFile.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- Aes.cs
- SharedPerformanceCounter.cs
- DrawTreeNodeEventArgs.cs
- JournalNavigationScope.cs
- COM2ExtendedBrowsingHandler.cs
- FlowSwitchLink.cs
- RemotingConfigParser.cs
- LockedHandleGlyph.cs
- CancellationState.cs
- ImageIndexConverter.cs
- HandlerElement.cs
- XmlSchemaType.cs
- StylusEditingBehavior.cs
- PersonalizationStateQuery.cs
- BindToObject.cs
- SuppressIldasmAttribute.cs
- CqlParserHelpers.cs
- shaperfactoryquerycachekey.cs
- ExceptionUtil.cs
- RegexTree.cs
- ConnectionPoint.cs
- BinaryParser.cs
- LocationUpdates.cs
- StateItem.cs
- DSASignatureFormatter.cs
- ConsoleKeyInfo.cs
- PropertyRecord.cs
- PersonalizableTypeEntry.cs
- RuntimeConfig.cs
- PlatformNotSupportedException.cs
- Token.cs
- MatrixAnimationUsingPath.cs
- __TransparentProxy.cs
- CapabilitiesRule.cs
- DataGridViewHeaderCell.cs
- ExceptionCollection.cs
- SymbolMethod.cs
- ByteStorage.cs
- CfgParser.cs
- XmlChildEnumerator.cs
- ComPlusThreadInitializer.cs
- ScrollProperties.cs
- HttpCookie.cs
- ScriptRegistrationManager.cs
- ExpressionDumper.cs
- BooleanSwitch.cs
- UrlAuthFailedErrorFormatter.cs
- ProgramNode.cs
- AsyncResult.cs
- MarkupCompilePass1.cs
- SqlRewriteScalarSubqueries.cs
- EmbeddedMailObjectsCollection.cs