Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / 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. //---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: DocumentViewerBaseAutomationPeer.cs // // Description: AutomationPeer associated with DocumentViewerBase. // //--------------------------------------------------------------------------- using System.Collections.Generic; // List using 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
- TrackingProfileCache.cs
- ButtonColumn.cs
- PackageRelationship.cs
- ButtonRenderer.cs
- DesigntimeLicenseContext.cs
- XslAst.cs
- ClientSideQueueItem.cs
- SelectingProviderEventArgs.cs
- UIElement.cs
- MethodBuilder.cs
- RijndaelManagedTransform.cs
- LeftCellWrapper.cs
- Instrumentation.cs
- XmlSchemaComplexContent.cs
- FormViewAutoFormat.cs
- SortedList.cs
- StrongNamePublicKeyBlob.cs
- CannotUnloadAppDomainException.cs
- SqlDependencyUtils.cs
- WebServiceResponseDesigner.cs
- CodeThrowExceptionStatement.cs
- CommandHelper.cs
- GridViewPageEventArgs.cs
- querybuilder.cs
- ReferenceEqualityComparer.cs
- GACIdentityPermission.cs
- AutoResizedEvent.cs
- XmlTextAttribute.cs
- ConfigurationValidatorAttribute.cs
- ApplicationFileParser.cs
- Crc32Helper.cs
- DispatchChannelSink.cs
- RotateTransform.cs
- PropertyEmitterBase.cs
- MenuStrip.cs
- Schema.cs
- MarkupCompiler.cs
- ToolStripMenuItem.cs
- ClaimSet.cs
- BinaryHeap.cs
- AnonymousIdentificationSection.cs
- InputLanguageEventArgs.cs
- RegexRunnerFactory.cs
- externdll.cs
- Padding.cs
- MouseButton.cs
- MobileControlPersister.cs
- QueryCacheEntry.cs
- ConfigurationValidatorBase.cs
- XmlNodeList.cs
- ContentFileHelper.cs
- SqlRetyper.cs
- XmlDocumentSurrogate.cs
- ObjectManager.cs
- WeakEventTable.cs
- cookie.cs
- LineUtil.cs
- XmlSchemaSimpleTypeUnion.cs
- ExpressionTable.cs
- LogLogRecordEnumerator.cs
- TypeExtensions.cs
- BindingCompleteEventArgs.cs
- ToolStripProgressBar.cs
- DiffuseMaterial.cs
- TraceHwndHost.cs
- HashCodeCombiner.cs
- EraserBehavior.cs
- AsymmetricSignatureFormatter.cs
- EdmSchemaError.cs
- MsmqIntegrationProcessProtocolHandler.cs
- SqlDataReader.cs
- Propagator.cs
- PrivacyNoticeBindingElement.cs
- FixedBufferAttribute.cs
- Win32.cs
- DebugHandleTracker.cs
- SqlNodeAnnotations.cs
- PageSettings.cs
- ResolvedKeyFrameEntry.cs
- ProviderConnectionPointCollection.cs
- EventEntry.cs
- SlipBehavior.cs
- AccessKeyManager.cs
- DataRelationPropertyDescriptor.cs
- EntityContainerEntitySetDefiningQuery.cs
- UserControlAutomationPeer.cs
- Permission.cs
- ObservableCollectionDefaultValueFactory.cs
- OutputCacheSettings.cs
- ListenerConstants.cs
- MethodBuilder.cs
- BamlResourceContent.cs
- LocalizabilityAttribute.cs
- PlainXmlWriter.cs
- EditorAttribute.cs
- Pointer.cs
- WebPartTransformerCollection.cs
- WorkflowOperationFault.cs
- StylusShape.cs
- XmlCharCheckingReader.cs