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
- PaintEvent.cs
- EmptyControlCollection.cs
- TemplateComponentConnector.cs
- EntityDesignPluralizationHandler.cs
- Panel.cs
- FrameworkContentElementAutomationPeer.cs
- SpinWait.cs
- XmlBoundElement.cs
- SystemParameters.cs
- HtmlInputRadioButton.cs
- ServiceAuthorizationBehavior.cs
- Predicate.cs
- TextTreeExtractElementUndoUnit.cs
- GeneralTransform3DCollection.cs
- Soap.cs
- TransactionBridgeSection.cs
- SchemaImporterExtension.cs
- EncoderExceptionFallback.cs
- FileRegion.cs
- CompareValidator.cs
- SourceFileBuildProvider.cs
- TextProviderWrapper.cs
- ConfigurationValidatorBase.cs
- PartBasedPackageProperties.cs
- Menu.cs
- DBCommand.cs
- DropShadowBitmapEffect.cs
- LoginNameDesigner.cs
- ObjectDataSourceEventArgs.cs
- FileLogRecordEnumerator.cs
- RelatedPropertyManager.cs
- DoubleLinkList.cs
- ElementMarkupObject.cs
- ViewgenContext.cs
- CodeDefaultValueExpression.cs
- EnumerableWrapperWeakToStrong.cs
- BoundColumn.cs
- NativeMethods.cs
- Point3DAnimation.cs
- CustomErrorCollection.cs
- RuntimeConfigLKG.cs
- _BufferOffsetSize.cs
- DesignConnectionCollection.cs
- ErrorTolerantObjectWriter.cs
- HttpStaticObjectsCollectionBase.cs
- TextChange.cs
- TakeOrSkipWhileQueryOperator.cs
- HealthMonitoringSection.cs
- EntityKeyElement.cs
- TabControlCancelEvent.cs
- SystemBrushes.cs
- CompareValidator.cs
- SizeF.cs
- SvcFileManager.cs
- PathFigure.cs
- AdRotatorDesigner.cs
- StringTraceRecord.cs
- XmlCountingReader.cs
- OrderByBuilder.cs
- ISFClipboardData.cs
- BufferedConnection.cs
- MetadataItemEmitter.cs
- DbParameterCollectionHelper.cs
- DragStartedEventArgs.cs
- FontStyle.cs
- serverconfig.cs
- WorkflowOperationAsyncResult.cs
- HttpCacheVary.cs
- WpfWebRequestHelper.cs
- XmlEntity.cs
- StronglyTypedResourceBuilder.cs
- GenerateHelper.cs
- Imaging.cs
- DesignerDataParameter.cs
- NameGenerator.cs
- ISO2022Encoding.cs
- QuotedPrintableStream.cs
- Size3DValueSerializer.cs
- BamlCollectionHolder.cs
- TextWriterTraceListener.cs
- WebServiceHost.cs
- HttpResponseHeader.cs
- DataTableExtensions.cs
- Package.cs
- StringSource.cs
- XmlConvert.cs
- DeviceContext2.cs
- ViewValidator.cs
- XmlQueryContext.cs
- UrlPath.cs
- OverlappedAsyncResult.cs
- dsa.cs
- CellParaClient.cs
- ProcessHost.cs
- HtmlElementErrorEventArgs.cs
- DescendentsWalkerBase.cs
- AppDomainCompilerProxy.cs
- LogExtentCollection.cs
- HorizontalAlignConverter.cs
- DependencyObject.cs