Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Automation / Peers / DocumentViewerBaseAutomationPeer.cs / 1 / DocumentViewerBaseAutomationPeer.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: DocumentViewerBaseAutomationPeer.cs // // Description: AutomationPeer associated with DocumentViewerBase. // //--------------------------------------------------------------------------- using System.Collections.Generic; // Listusing System.Windows.Controls.Primitives; // DocumentViewerBase using System.Windows.Documents; // IDocumentPaginatorSource namespace System.Windows.Automation.Peers { /// /// AutomationPeer associated with DocumentViewerBase. /// public class DocumentViewerBaseAutomationPeer : FrameworkElementAutomationPeer { ////// Constructor. /// /// Owner of the AutomationPeer. public DocumentViewerBaseAutomationPeer(DocumentViewerBase owner) : base(owner) { } ////// public override object GetPattern(PatternInterface patternInterface) { object returnValue = null; if (patternInterface == PatternInterface.Text) { // Make sure that Automation children are created. this.GetChildren(); // Re-expose TextPattern from hosted document. if (_documentPeer != null) { _documentPeer.EventsSource = this; returnValue = _documentPeer.GetPattern(patternInterface); } } return returnValue; } ////// /// ////// /// AutomationPeer associated with DocumentViewerBase returns an AutomationPeer /// for hosted Document and for elements in the style. /// protected override ListGetChildrenCore() { // Get children for all elements in the style. List children = base.GetChildrenCore(); // Add AutomationPeer associated with the document. // Make it the first child of the collection. AutomationPeer documentPeer = GetDocumentAutomationPeer(); if (_documentPeer != documentPeer) { if (_documentPeer != null) { _documentPeer.OnDisconnected(); } _documentPeer = documentPeer as DocumentAutomationPeer; } if (documentPeer != null) { if (children == null) { children = new List (); } children.Add(documentPeer); } return children; } /// /// protected override AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Document; } ////// /// protected override string GetClassNameCore() { return "DocumentViewer"; } ////// /// Retrieves AutomationPeer for the document. /// ///private AutomationPeer GetDocumentAutomationPeer() { AutomationPeer documentPeer = null; IDocumentPaginatorSource document = ((DocumentViewerBase)Owner).Document; if (document != null) { if (document is UIElement) { documentPeer = UIElementAutomationPeer.CreatePeerForElement((UIElement)document); } else if (document is ContentElement) { documentPeer = ContentElementAutomationPeer.CreatePeerForElement((ContentElement)document); } } return documentPeer; } private DocumentAutomationPeer _documentPeer; } } // 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
- Vector3dCollection.cs
- XmlCustomFormatter.cs
- IdentifierCollection.cs
- JsonWriter.cs
- RoleBoolean.cs
- UnsafeNativeMethods.cs
- MessageSecurityTokenVersion.cs
- FunctionDefinition.cs
- DataSourceHelper.cs
- XhtmlTextWriter.cs
- GridViewDeletedEventArgs.cs
- ProgressiveCrcCalculatingStream.cs
- ConnectionInterfaceCollection.cs
- PasswordBoxAutomationPeer.cs
- FileSystemInfo.cs
- ArrayHelper.cs
- EditingCommands.cs
- GridViewItemAutomationPeer.cs
- StaticExtensionConverter.cs
- BufferBuilder.cs
- baseaxisquery.cs
- DataServiceConfiguration.cs
- NonSerializedAttribute.cs
- DocumentReference.cs
- UnsafeNativeMethods.cs
- XPathExpr.cs
- RijndaelManaged.cs
- CacheDependency.cs
- FigureParagraph.cs
- DesignerLinkAdapter.cs
- DataGridGeneralPage.cs
- OracleBFile.cs
- CodeDelegateInvokeExpression.cs
- DiagnosticsConfigurationHandler.cs
- AppDomainGrammarProxy.cs
- AffineTransform3D.cs
- AsyncOperation.cs
- DataGridSortCommandEventArgs.cs
- WebControlsSection.cs
- RelationshipConstraintValidator.cs
- WindowsTab.cs
- BinaryParser.cs
- XmlIncludeAttribute.cs
- FileNotFoundException.cs
- Privilege.cs
- CancellationHandlerDesigner.cs
- SByteStorage.cs
- DataGridViewBand.cs
- ResourceManagerWrapper.cs
- FormViewUpdateEventArgs.cs
- DateTimeOffset.cs
- HttpProtocolImporter.cs
- StoreAnnotationsMap.cs
- CryptographicAttribute.cs
- EventItfInfo.cs
- BinaryObjectReader.cs
- VisualStateGroup.cs
- WebPartDescription.cs
- MessageLoggingElement.cs
- ServiceModelTimeSpanValidator.cs
- ImageSourceTypeConverter.cs
- RelatedView.cs
- WebBrowserNavigatingEventHandler.cs
- Number.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- BitmapEncoder.cs
- RemotingConfiguration.cs
- CompiledXpathExpr.cs
- RadioButtonAutomationPeer.cs
- EnterpriseServicesHelper.cs
- ImmutablePropertyDescriptorGridEntry.cs
- CompilationPass2TaskInternal.cs
- FillRuleValidation.cs
- PersistencePipeline.cs
- SessionStateUtil.cs
- DispatcherFrame.cs
- ConfigurationLocationCollection.cs
- GridViewColumnHeader.cs
- ObjectSpanRewriter.cs
- ToolboxCategoryItems.cs
- ObjectAnimationBase.cs
- WebPartChrome.cs
- ComplexType.cs
- SemanticBasicElement.cs
- TrackingWorkflowEventArgs.cs
- XmlSchemaSearchPattern.cs
- DataGridViewTopLeftHeaderCell.cs
- DefaultValueAttribute.cs
- errorpatternmatcher.cs
- LinearQuaternionKeyFrame.cs
- CompositeFontParser.cs
- FunctionImportElement.cs
- XmlIlTypeHelper.cs
- COM2ColorConverter.cs
- OleDbEnumerator.cs
- recordstate.cs
- Base64Stream.cs
- FaultDesigner.cs
- _NestedSingleAsyncResult.cs
- XmlImplementation.cs