Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / DocumentViewerBaseAutomationPeer.cs / 1305600 / 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); } } else { returnValue = base.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
- UITypeEditor.cs
- OutputScope.cs
- SpoolingTask.cs
- ViewValidator.cs
- XmlDataLoader.cs
- DialogResultConverter.cs
- CompilationRelaxations.cs
- Stylesheet.cs
- DecoratedNameAttribute.cs
- ProgressChangedEventArgs.cs
- EditorReuseAttribute.cs
- MaskInputRejectedEventArgs.cs
- ThicknessAnimationBase.cs
- QueueSurrogate.cs
- EntityProviderServices.cs
- SimpleTextLine.cs
- RSAPKCS1SignatureDeformatter.cs
- SelectionChangedEventArgs.cs
- CompoundFileStreamReference.cs
- Point3DIndependentAnimationStorage.cs
- VisualTarget.cs
- PropertyIDSet.cs
- ParameterElementCollection.cs
- Serializer.cs
- PageContentCollection.cs
- HttpResponseInternalWrapper.cs
- SiteMap.cs
- OleDbRowUpdatedEvent.cs
- UnsafeNativeMethods.cs
- SQLInt32.cs
- XmlReflectionMember.cs
- ToolStripPanel.cs
- securitycriticaldataClass.cs
- ThreadStartException.cs
- HyperLink.cs
- SoapRpcServiceAttribute.cs
- Token.cs
- UDPClient.cs
- SqlFactory.cs
- ColorTransformHelper.cs
- Transform.cs
- ListControl.cs
- SurrogateSelector.cs
- ScrollableControlDesigner.cs
- XmlParser.cs
- Bind.cs
- HttpProfileBase.cs
- CompositionAdorner.cs
- MailDefinitionBodyFileNameEditor.cs
- RemotingAttributes.cs
- SubMenuStyleCollection.cs
- PageFunction.cs
- Random.cs
- XhtmlBasicCommandAdapter.cs
- Boolean.cs
- DrawingContextDrawingContextWalker.cs
- DocumentGridContextMenu.cs
- rsa.cs
- SHA384Cng.cs
- SmiContextFactory.cs
- PingOptions.cs
- ObjectDataSourceSelectingEventArgs.cs
- PropVariant.cs
- _HeaderInfo.cs
- NullReferenceException.cs
- NumericUpDownAccelerationCollection.cs
- RegexGroupCollection.cs
- Package.cs
- TextAnchor.cs
- PathTooLongException.cs
- initElementDictionary.cs
- Cursor.cs
- WasNotInstalledException.cs
- ListenerElementsCollection.cs
- SetStateDesigner.cs
- TextParagraphView.cs
- XamlWriterExtensions.cs
- TabRenderer.cs
- Accessors.cs
- BuildProvider.cs
- DesignTimeTemplateParser.cs
- RoleService.cs
- NonVisualControlAttribute.cs
- ServiceSecurityAuditBehavior.cs
- WeakReferenceKey.cs
- SafeMILHandleMemoryPressure.cs
- ResourceKey.cs
- UpdateTranslator.cs
- DataGridViewHitTestInfo.cs
- PolicyManager.cs
- PersistenceException.cs
- RenderDataDrawingContext.cs
- EdmConstants.cs
- WpfSharedBamlSchemaContext.cs
- Types.cs
- IntegerCollectionEditor.cs
- Rules.cs
- EntitySqlQueryCacheKey.cs
- TimeZone.cs
- SpnegoTokenProvider.cs